You are not logged in.

#1 2016-04-10 18:36:49

GartenEden
Member
From: Germany
Registered: 2016-04-10
Posts: 10

[Solved] .zprofile not sourced

Hello guys and girls,

I know, I know, there are a lot of results for this subject but I really looked them through and couldn't find a solution.

Actually, all I want is adding ~/bin/ to my $PATH. So, as described in the Arch Wiki, I added this to my .zprofile:

typeset -U path
path=(~/bin $path[@])

But it doesn't work. If I run "source .zprofile" manually, it does work though. So apprently, .zprofile isn't sourced.

What am I missing?

Last edited by GartenEden (2016-04-11 18:17:40)

Offline

#2 2016-04-10 18:41:07

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 12,476
Website

Re: [Solved] .zprofile not sourced

Have you logged out and back in since editing .zprofile? It is only read for login shells.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#3 2016-04-10 18:42:51

GartenEden
Member
From: Germany
Registered: 2016-04-10
Posts: 10

Re: [Solved] .zprofile not sourced

I restarted the machine, yes.
For login shells only? You mean, it's not parsed for my gnome-terminal? Shall I put the code in .zshrc then?

Offline

#4 2016-04-10 18:56:32

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 12,476
Website

Re: [Solved] .zprofile not sourced

It's not parsed for interactive shells, no, but the values set in the login shell should be inherited by the interactive shells. To be honest, I've never seen environment variable manipulation done like that. You may want to try a basic

export PATH="~/bin:$PATH"

in your zprofile instead and see if that works.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#5 2016-04-10 19:00:07

GartenEden
Member
From: Germany
Registered: 2016-04-10
Posts: 10

Re: [Solved] .zprofile not sourced

It's also described in zsh's guide. Anyway, I tried your suggestion, it doesn't work either.
As I said, if I source .zprofile by hand, the $PATH is updated for that terminal session, as expected.

Offline

#6 2016-04-10 19:17:06

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 12,476
Website

Re: [Solved] .zprofile not sourced

Strange. Are you explicitly setting PATH anywhere in your .zshrc and/or .zlogin?

STARTUP/SHUTDOWN FILES
       Commands are first read from /etc/zshenv; this cannot be overridden.  Subsequent behaviour
       is modified by the RCS and GLOBAL_RCS options; the former affects all startup files, while
       the  second only affects global startup files (those shown here with an path starting with
       a /).  If one of the options is unset at any point, any subsequent startup file(s) of  the
       corresponding  type  will  not  be  read.   It  is also possible for a file in $ZDOTDIR to
       re-enable GLOBAL_RCS. Both RCS and GLOBAL_RCS are set by default.

       Commands are then read from $ZDOTDIR/.zshenv.  If the shell is a login shell, commands are
       read  from  /etc/zprofile and then $ZDOTDIR/.zprofile.  Then, if the shell is interactive,
       commands are read from /etc/zshrc and then $ZDOTDIR/.zshrc.  Finally, if the  shell  is  a
       login shell, /etc/zlogin and $ZDOTDIR/.zlogin are read.

Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#7 2016-04-10 19:29:29

GartenEden
Member
From: Germany
Registered: 2016-04-10
Posts: 10

Re: [Solved] .zprofile not sourced

This is my .zshrc.
(Both sourced files at the end don't change the $PATH)

My .zprofile consists only of

export PATH="~/bin:$PATH"

now. I logged out and in again.

Offline

#8 2016-04-10 23:41:03

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] .zprofile not sourced

That hastebin link is broken...

Does this work?

typeset -U path
path=($HOME/bin $path)

Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#9 2016-04-11 07:11:43

GartenEden
Member
From: Germany
Registered: 2016-04-10
Posts: 10

Re: [Solved] .zprofile not sourced

Oh, they deleted it... Here is my .zshrc again.

@jasonwryan: As I said, the code seems once it is sourced—if I source it manually, it works—so I guess the problem is not the code the self but that .zprofile isn't sourced when I run my gnome-terminal. (I tried your snippet anyway, doesn't work.)

Offline

#10 2016-04-11 07:18:28

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] .zprofile not sourced

How do you login? You aren't using GDM are you?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#11 2016-04-11 12:19:17

GartenEden
Member
From: Germany
Registered: 2016-04-10
Posts: 10

Re: [Solved] .zprofile not sourced

jasonwryan wrote:

How do you login? You aren't using GDM are you?

Yes, I do.

Offline

#12 2016-04-11 16:45:59

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] .zprofile not sourced

Display Managers "helpfully" ignore some of the shell initialisation files. That is why your .zprofile isn't being read...

See: http://unix.stackexchange.com/questions … nvironment


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#13 2016-04-11 16:52:30

GartenEden
Member
From: Germany
Registered: 2016-04-10
Posts: 10

Re: [Solved] .zprofile not sourced

@jasonwryan Thanks for the link.
So I decided to put the PATH part to .zshrc. I hope it's not too bad.

Anyway, it seems to work. Thank you for your help.

Offline

#14 2016-04-11 18:16:37

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] .zprofile not sourced

Please remember to mark your thread as [Solved] by editing your first post and prepending it to the title.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB