terminal

Mac OS X: Bring GUI applications to foreground when launched from the command line

那年仲夏 提交于 2019-12-19 08:30:45
问题 Is there a way to bring GUI applications to the foreground when starting them from within Terminal on Mac OS X? If I run /Applications/TextEdit.app/Contents/MacOS/TextEdit in Terminal, TextEdit opens in the background. This is quite annoying if you're using "make && ./run" when developing GUI applications. 回答1: At least for TextEdit and similar GUI apps, open will work: > open /Applications/TextEdit.app 回答2: There seems to be even shorter variant: > open -a TextEdit 来源: https://stackoverflow

Change background of Terminal.app from the commandline

天涯浪子 提交于 2019-12-19 07:38:31
问题 Is it possible to change the background color of Terminal.app from the shell? If so, how? 回答1: osascript -e "tell application \"Terminal\" to set background color of window 1 to {0,45000,0,0}" (Can't take the credit) 回答2: I don't know the specifics, but I imagine you'd want to write an AppleScript program which you invoke from your shell script. The AppleScript would "Tell" Terminal to change its background colour. 来源: https://stackoverflow.com/questions/549186/change-background-of-terminal

Express Node.js doesn't work

白昼怎懂夜的黑 提交于 2019-12-19 07:29:07
问题 I installed express 4 along with node.js,npm and express-generator on my ubuntu 12.04 and created an app using the following commands: express test --hogan -c less cd test && npm install node app.js Now what I should get is "Express server running on port 3000" but instead the command simply executes and doesn't leave any message or error. So I have no idea of which port express is running on or whether or not it is running at all. So does anyone know what's going wrong in it? Thanks in

Extract .xip files into a specific folder

泪湿孤枕 提交于 2019-12-19 05:45:07
问题 A XIP file is an analog to zip, but allows for a digital signature to be applied and verified on the receiving system, before the archive is expanded. When a XIP file is opened (by double-clicking), Archive Utility will automatically expand it (but only if the digital signature is intact). Essentially, a .xip file is just a .zip with a signature to verify that the file has not changed since its creator saved it. This protects from both damage from a disk error and from a third-party tampering

How to open then the Android SDK Manager through the terminal? [duplicate]

末鹿安然 提交于 2019-12-19 05:37:05
问题 This question already has answers here : Android SDK manager won't open (31 answers) Closed 5 years ago . I have CD'd into my android tools directory in the terminal. I tried typing 'android' and hitting enter and I also tried typing 'android sdk' and hitting enter but the sdk manager would not come up. Any solutions or advice to help me understand what I'm doing wrong? 回答1: From outside the tools directory (obviously, you need to change to suit your path taste): $ sudo /opt/android-sdk

Move usr/bin/java in Terminal

落爺英雄遲暮 提交于 2019-12-19 05:23:07
问题 After updating to OS X 10.11, my java stopped working. I read multiple places that I should do a: sudo mv /usr/bin/java /usr/bin/java.old sudo ln -ns /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java /usr/bin/java But the issue is when I run the first line of code, I just get: mv: rename /usr/bin/java to /usr/bin/java.old: Operation not permitted Any ideas what I can do to fix this? 回答1: Seems like the problem with the new System Integration Protection (a.k.a rootless

Open Terminal from shell and execute commands [duplicate]

被刻印的时光 ゝ 提交于 2019-12-19 05:19:33
问题 This question already has answers here : Running a command in a new Mac OS X Terminal window (10 answers) Closed last year . I am lazy so I want to write a shell script to open my dev environment. I setup two commands dev and dev-startup . When I run dev /directory/path it should open a new terminal window at /directory/path and execute dev-startup . I'm not sure how to open the terminal window at a specific directory and then run a final command to run the tools I need to setup the

How to change the language of my git?

断了今生、忘了曾经 提交于 2019-12-19 05:08:04
问题 My ˋgitˋ is in german, it says: ˋAuf Zweig masterˋ instead of On branch master with git status . What's the reason for this? 回答1: Probably you locale is german. You can see it by locale . Try to change it by: export LANG="en_US.UTF-8" 回答2: The reason for this is that your command line language is set to german. So when you do: echo $LANG you will see: de_DE.UTF-8 To change this, do: echo "export LANG=en_US.UTF-8" >> ~/.bashrc assuming your standard shell is bash. 回答3: Sometimes changing the

How to run an adb command through a Java file?

六眼飞鱼酱① 提交于 2019-12-19 04:58:35
问题 I have written the following code and cannot quite figure out how to solve the error. Not sure if this information will be found useful, but I am using a Mac and using the editor IntelliJ. public class TestCode { public static void main(String[] args) throws Exception { Runtime runtime = Runtime.getRuntime(); Process process = runtime.exec("adb devices"); } } The result is "Exception in thread "main" java.io.IOException: Cannot run program "adb": error=2, No such file or directory" However,

Running C scripts with terminal instead of Xcode

让人想犯罪 __ 提交于 2019-12-19 04:52:05
问题 Currently I am developing a couple of C programs on my mac using Xcode. There however is 1 problem. My study requires me to use some sort of input field through the coding. So for instance if the users wants to run the program 10 times or wants the program to create 10 answers. I am using "atoi(argv[1])" just to get the input from the user. This is exactly the problem. As soon as I run the program it just starts to bug, which is normal I quess because he is waiting for the input and not