Different paths between Terminal and iTerm?

2,163 views
Skip to first unread message

Rainer M Krug

unread,
Dec 10, 2013, 10:04:25 AM12/10/13
to iterm2-...@googlegroups.com
Hi

I have different paths between Terminal and iTerm (the ":" is replaced
with " : " for clarity):


,----
| iTerm:
| /Users/rainerkrug/bin : /usr/local/bin : /usr/local/sbin : /usr/bin
: /bin : /usr/sbin : /sbin : /opt/X11/bin : /usr/local/git/bin :
/usr/texbin : /usr/bin : /bin : /usr/sbin : /sbin : /usr/local/bin :
$HOME/bin\2345�\ : /opt/X11/bin : /usr/local/git/bin :
/usr/local/MacGPG2/bin : /usr/texbin
`----

,----
| Terminal :
| /Users/rainerkrug/bin : /usr/local/bin : /usr/local/sbin : /usr/bin
: /bin : /usr/sbin : /sbin : /opt/X11/bin : /usr/local/git/bin :
/usr/texbin : /usr/bin : /bin : /usr/sbin : /sbin : /usr/local/bin :
$HOME/bin : /opt/X11/bin : /usr/local/git/bin : /usr/local/MacGPG2/bin
: /usr/texbin
`----

The difference is the $HOME/bin\... which seems to be causing problems
when launching applications via "open".

Any suggestions, why these are different and how I can fix this?

Thanks,

Rainer


--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel : +33 - (0)9 53 10 27 44
Cell: +33 - (0)6 85 62 59 98
Fax : +33 - (0)9 58 10 27 44

Fax (D): +49 - (0)3 21 21 25 22 44

email: Rai...@krugs.de

Skype: RMkrug

Rainer M Krug

unread,
Dec 10, 2013, 10:37:39 AM12/10/13
to iterm2-...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



On 12/10/13, 16:04 , Rainer M Krug wrote:
> Hi
>
> I have different paths between Terminal and iTerm (the ":" is
> replaced with " : " for clarity):
>
>
> ,---- | iTerm: | /Users/rainerkrug/bin : /usr/local/bin :
> /usr/local/sbin : /usr/bin : /bin : /usr/sbin : /sbin :
> /opt/X11/bin : /usr/local/git/bin : /usr/texbin : /usr/bin : /bin :
> /usr/sbin : /sbin : /usr/local/bin : $HOME/bin\2345�\ :
> /opt/X11/bin : /usr/local/git/bin : /usr/local/MacGPG2/bin :
> /usr/texbin `----
>
> ,---- | Terminal : | /Users/rainerkrug/bin : /usr/local/bin :
> /usr/local/sbin : /usr/bin : /bin : /usr/sbin : /sbin :
> /opt/X11/bin : /usr/local/git/bin : /usr/texbin : /usr/bin : /bin :
> /usr/sbin : /sbin : /usr/local/bin : $HOME/bin : /opt/X11/bin :
> /usr/local/git/bin : /usr/local/MacGPG2/bin : /usr/texbin `----
>
> The difference is the $HOME/bin\... which seems to be causing
> problems when launching applications via "open".
>
> Any suggestions, why these are different and how I can fix this?

OK - this is getting more interesting now: this is not consistent -
when I start a new tab on my "hotkey" iTerm, I just got alternating
paths - correct - wrong, ...

Very strange


>
> Thanks,
>
> Rainer
>
>

- --
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel : +33 - (0)9 53 10 27 44
Cell: +33 - (0)6 85 62 59 98
Fax : +33 - (0)9 58 10 27 44

Fax (D): +49 - (0)3 21 21 25 22 44

email: Rai...@krugs.de

Skype: RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJSpzVDAAoJENvXNx4PUvmCG48IAMMzTESg98o1dGTXdvqwJPIm
os38C/cn2uK18u7GwWxI/qjOF+2fJRjftQpkknSTHn11CQva1lVdg0+YxI0kewqY
ZEHy8jxCGtSPPjkBEPcXf3WuA/PKgdAl24oPddHFLfI2QUq2HKWevT0HNE8rjRL3
7l6KAO6+I8R9psieJztjHzZ4dr/RIdQ7utSCtrfjAb8AkFKLHDo2yQhdral9LRVl
e1FbCoaEJYgcM4+AMVJbaABlAYQZo69gZiSGwcIJSFcfpkbEj7HvAys57OjwsccL
OHYQezpPI6wzMeMEMpQZRO8HTQrC0yvdQOYcVW/MuliJ2DJhFpB5Xp6Qld1Ny4I=
=3Gdl
-----END PGP SIGNATURE-----

TJ Luoma

unread,
Dec 10, 2013, 11:29:34 AM12/10/13
to iterm2-...@googlegroups.com
What $SHELL do you use?

Do you have a PATH= in your $SHELL rc file?

is iTerm set to start 'your login shell' or does it explicitly have a
path such as /bin/zsh ?

Rainer M Krug

unread,
Dec 10, 2013, 1:30:33 PM12/10/13
to iterm2-...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Here is the additional info:

On 12/10/13, 17:29 , TJ Luoma wrote:
> What $SHELL do you use?

bash

>
> Do you have a PATH= in your $SHELL rc file?

.bash_profile

,----
| alias
emacs="/usr/local/Cellar/emacs/24.3/Emacs.app/Contents/MacOS/Emacs -nw"
|
| export
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin:/usr/texbin:$PATH
|
| ## Homebrew
| export
HOMEBREW_GITHUB_API_TOKEN=6fb92887ac7d8317656501ec1193e05e0f360d01
| export PATH=/usr/local/bin:/usr/local/sbin:$PATH
| source `brew --repository`/Library/Contributions/brew_bash_completion.sh
|
| # Finally add ~/bin at first location in PATH
| export PATH=~/bin:$PATH
|
| # define EDITOR
| export EDITOR="emacs -Q"
|
| # define infopath to get correct info manual of org-mode
| # export
INFOPATH=$HOME/.emacs.d/org-mode/doc:$HOME/.emacs.d/ess/doc:$INFOPATH/
`----

>
> is iTerm set to start 'your login shell' or does it explicitly have
> a path such as /bin/zsh ?

I haven't changed anything in that regard - it is the login shell.


>

- --
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel : +33 - (0)9 53 10 27 44
Cell: +33 - (0)6 85 62 59 98
Fax : +33 - (0)9 58 10 27 44

Fax (D): +49 - (0)3 21 21 25 22 44

email: Rai...@krugs.de

Skype: RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJSp13JAAoJENvXNx4PUvmCIn8H/RljRPdgZ+mh1WdD7Z3Imq9e
b6/Wpcb8j2kT9UfuwLIoZyJqKq/qS7EAZQYdioQcoxsoCEKoNtKzt1PrY+GdJ0tS
tN76iYa3uhQnk7lVff6u0BRozkmiPsW1KWEObH8spZLwryhvdFJJHhr0EnPWM3QO
UYY0cmbMIzkkCDPZ9hogWmapnMpnsdVSeiriwAsaFr123NnbPLlsHvLcd+JF4HcN
o3v4qsscSKgTrnzLoLLUSHUjG6c8sOJ49Rb6IOHkBbGTyWaHlUBNWfXZOycHkn44
Df+d9iO38d47Nf6mvGXv3yXR0BZDljRHHXAlWtlDpNRs9V2C1JA/2BixF8aiNBo=
=Ixkq
-----END PGP SIGNATURE-----

Joshua Keroes

unread,
Dec 10, 2013, 1:55:18 PM12/10/13
to iterm2-...@googlegroups.com
The problem isn't in your .bash_profile. Something else is changing your PATH later.

To track down the problem, run "bash --login -vx" in each terminal. That will show the startup commands as they're executed, one by one.

Once you find which file is appending $HOME/bin/mumble to your path, take a closer look. Maybe you'll find stray Unicode characters there. `cat -etv file` can help. 



--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discus...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

TJ Luoma

unread,
Dec 10, 2013, 2:24:58 PM12/10/13
to iterm2-...@googlegroups.com
On Tue, Dec 10, 2013 at 1:30 PM, Rainer M Krug <Rai...@krugs.de> wrote:
>
> export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin:/usr/texbin:$PATH

The $PATH that you are including at the end of your PATH line may
already contain the same things you are including.

I'd try removing that and when you login, do

echo "$PATH"

and then add whatever is shown there explicitly to your PATH definition.

TjL

George Nachman

unread,
Dec 10, 2013, 2:28:58 PM12/10/13
to iterm2-...@googlegroups.com
Does the nightly build (iterm2.com/nightly/latest) fix the issue for you?

It's probably because in 1.0.0 and the v2 betas that we don't spawn a login shell when opening a new session whose initial PWD is not your home directory since login(1) resets your directory to home. In the nightly builds, there's a little hack to work around that so you always get a login shell.

The workaround for v2 is to assume you're not getting a login shell and set your path in .bashrc not .bash_profile.


Rainer M Krug

unread,
Dec 12, 2013, 4:26:53 AM12/12/13
to iterm2-...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



On 12/10/13, 20:28 , George Nachman wrote:
> Does the nightly build (iterm2.com/nightly/latest
> <http://iterm2.com/nightly/latest>) fix the issue for you?

Nope - worse actually: I get the offending $PATH even in the first window.

Here are the offewnding elements in 5 tabs in the same window:

$HOME/bin??
$HOME/bin,??
$HOME/bin0?
$HOME/bin4
$HOME/bin ?

This sequence is not consistent, in another iTerm window the paths of
five consecutive tabs are different.

When resting iTerm, the sequence is again different.

All this is with the new nightly build.

Rainer


>
> It's probably because in 1.0.0 and the v2 betas that we don't spawn
> a login shell when opening a new session whose initial PWD is not
> your home directory since login(1) resets your directory to home.
> In the nightly builds, there's a little hack to work around that so
> you always get a login shell.
>
> The workaround for v2 is to assume you're not getting a login shell
> and set your path in .bashrc not .bash_profile.
>
>
> On Tue, Dec 10, 2013 at 11:24 AM, TJ Luoma <luo...@gmail.com
> <mailto:luo...@gmail.com>> wrote:
>
> On Tue, Dec 10, 2013 at 1:30 PM, Rainer M Krug <Rai...@krugs.de
> <mailto:Rai...@krugs.de>> wrote:
>>
>> export
> PATH=/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin:/usr/texbin:$PATH
>
> The $PATH that you are including at the end of your PATH line may
> already contain the same things you are including.
>
> I'd try removing that and when you login, do
>
> echo "$PATH"
>
> and then add whatever is shown there explicitly to your PATH
> definition.
>
> TjL
>
> -- You received this message because you are subscribed to the
> Google Groups "iterm2-discuss" group. To unsubscribe from this
> group and stop receiving emails from it, send an email to
> iterm2-discus...@googlegroups.com
> <mailto:iterm2-discuss%2Bunsu...@googlegroups.com>. For more
> options, visit https://groups.google.com/groups/opt_out.
>
>
> -- You received this message because you are subscribed to the
> Google Groups "iterm2-discuss" group. To unsubscribe from this
> group and stop receiving emails from it, send an email to
> iterm2-discus...@googlegroups.com. For more options,
> visit https://groups.google.com/groups/opt_out.

- --
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel : +33 - (0)9 53 10 27 44
Cell: +33 - (0)6 85 62 59 98
Fax : +33 - (0)9 58 10 27 44

Fax (D): +49 - (0)3 21 21 25 22 44

email: Rai...@krugs.de

Skype: RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJSqYFdAAoJENvXNx4PUvmCoxEIAMoUi05Fjk7FUw8cDwKTIdJU
chEmHTdfbXLPmv8+Ur8ZGVZ908Ko1SlMMSFac1W6CBj83IXHLZ/ijF9KMDTyRTCt
7JEVd4sfW94hM78JjRNaEE4tBSTK3Wa5snvxwGA+Wp6KRqO75Gi/fqmDO31cxq8W
0t6/wi98hq0m479b6/4vgKXzYHWhamcvgsYdtlsTK9iMceTvYoESJA8rSXhv4AUU
Yfp56M3loGvuHKjSJ49MiHU66VqBe3Vv+n1i4HUzoH6dhYZG9NAJq4nfXB0y4w6M
E3JDpGuyrhBd456ex/QE5AJuu202ARa0EMe5t+CSNliMmIrXGBfaVmflp7NHPo0=
=VRnB
-----END PGP SIGNATURE-----

Rainer M Krug

unread,
Dec 12, 2013, 4:55:35 AM12/12/13
to iterm2-...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I found the problem, and it seems to be working now:

in /etc/paths.d I have a file for $HOME/bin which I edited in nano. It
seems that there was a unicode character in there which I did not see.
Even deleting everything after the path did not help. I finally edited
in emacs, deleted the (here two!) "spaces" after the path and added a
RETURN, saved it, rebooted, and working.

I hope it stays like this,

Cheers and thanks,

Rainer
iQEcBAEBAgAGBQJSqYgXAAoJENvXNx4PUvmCQ9YH/13rvAsvNEKhbTxjEvEk3zbW
GpcJAn2hQZibXtiLxLTjL0UrZ8YxkKvAq5NmPYeJU9E5uwNzvcGMAj92duIIOG8j
/A6Vqoq5wa1292i0L4E2fnEIRzj505m8XaGAHVQIgKtvC7UpiP9XGupdHnZ1sNIZ
mMnIo5ysBdZ41aFT+SR3cyy0tW0R5H2UShaPTf2oR+yXUE2pJK0FvKu4SrtIvWhm
TudcxyW/2rJ0FATZCJwxj08yCPwanzlWPAi8SvH7KE7OkLECcWnLd0VLw6iR5N9S
GBTIoi5DQL4mFNcfVb7xuvdVfKQSDK88DHceO4U8QMQb8RuqDrz9VtuRUOrUGds=
=5RnP
-----END PGP SIGNATURE-----

TJ Luoma

unread,
Dec 12, 2013, 9:11:33 AM12/12/13
to iterm2-...@googlegroups.com
FWIW when troubleshooting stuff like this, `cat -v /path/to/file.ext`
will show you any 'unprintable' characters, and is often helpful for
showing what your regular editor might not.

(I just had to use it when I was trying to parse website headers from
`curl` and wondered why my `egrep` commands weren't matching EOLs. It
was because there were unprintable/non-Un*x characters at EOL which
appeared as ^M when I sent it through `cat -v`.)

If you use BBEdit, the 'Zap Gremlins' command is my favorite for
things like this. Plus it has a fun name.

TjL
Reply all
Reply to author
Forward
0 new messages