Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

While I'm running some program in Terminal (or iTerm2), when the program forks the process, the OS X desktop switches focus from the current application to the forked process. When this happens, the forked process name shows in OS X menu bar.

This is especially annoying while using full screen mode as it causes the workspace to change when the forked process receives focus.

How can I stop this focus switch from happening? These terminal programs are interrupting the work I'm doing in other applications while they run.

share|improve this question
    
Which programs are you calling from Terminal? –  patrix Aug 26 '13 at 16:27
    
Maven. The Maven Surefire plugin for running Java Unit tests uses this ForkedBooter class which always takes focus away from the terminal –  jdgilday Aug 27 '13 at 17:43
    
It's not just Maven but this is one of my concrete examples –  jdgilday Aug 27 '13 at 17:44
    
Could it be that it only happens with Java applications? –  patrix Aug 27 '13 at 17:57
    
Perhaps. If I find a counter-example I'll post –  jdgilday Aug 27 '13 at 18:09
show 2 more comments

2 Answers 2

up vote 3 down vote accepted

As @patrix has suggested, it seems I'm only having this problem with Java processes.

This answer over at StackOverflow seems to solve the problem

share|improve this answer
add comment

Can you run your terminal program in the background? I believe this will keep it from coming in focus on the desktop as well. Just add '&' to the end of the terminal command to run a process in the background.

So if your terminal command were:

sh someprocess.sh

change it to:

sh someprocess.sh &

To bring a background process to the foreground in terminal use the command:

fg

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.