How to start an app in the foreground?
You will need to edit the gitk file.

To find the location of your gitk file type the following

which gitk


Open the gitk file in a text editor, near the top you should see a line like the following

exec wish "$0" -- "$@"


Edit the line so that it looks like this

exec wish "$0" -- "$@" &amp; exec osascript -e "tell application \"Wish\" to activate"


The next time you invoke gitk from the terminal it will come to the foreground

Your question is similar to a question on stackoverflow, if you don't want to edit the gitk file you can find other ways to achieve it there https://stackoverflow.com/q/11248284/1873471