2

Every time I open a Terminal window the following is printed on the top:

launchctl usage: setenv <key> <value>

I figured something must be wrong with my .bash_profile but I could not find anything in there related to "Daemons/Services".

What else could it be?

1 Answer 1

2

If the message appears every time you open a terminal, there is probably a problem in one of ~/.bash_profile or /etc/profile. You are probably calling launchctl with wrong parameters. Try searching for the relevant line:

grep launchctl ~/.bash_profile /etc/profile ~/.profile ~/bash_login

That should show you which file is calling launchctl and you can then either remove the offending line or correct it.

bash only reads ~/bash_profile and /etc/profile when launched as a login shell. In OS X, when you open a new terminal, this is the case, whereas in most (if not all) other *nix terminals, an interactive, non-login shell is launched and ~/.bashrc is read instead. See here for more info.

6
  • OS X always launches a login shell from the Terminal. See joshstaiger.org/archives/2005/07/bash_profile_vs.html
    – slhck
    May 27, 2013 at 16:08
  • @slhck Oh! Thanks, did not know that, will update answer accordingly.
    – terdon
    May 27, 2013 at 16:13
  • I rewrote your answer a little so it makes more sense when looking at it from an OS X perspective. Since launchctl is exclusive to OS X I think it's easy enough to focus this on OS X and mention the difference to Linux at the end. Hope you don't mind :)
    – slhck
    May 27, 2013 at 17:13
  • @slhck not in the least, thanks. Any particular reason you removed ~/bash_login? Does that not exist on OSX?
    – terdon
    May 27, 2013 at 17:17
  • Sorry, I must've missed that. A rather uncommon file, but for the sake of completeness, this and ~/.profile could of course be mentioned.
    – slhck
    May 27, 2013 at 17:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .