最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

macos - How to update $PATH after installing PHP (OSX) - Stack Overflow

programmeradmin0浏览0评论

I've successfully installed PHP 8.1 on my OSX Catalina computer using homebrew. I can see the new version is installed in /usr/local/opt/[email protected]

Various other SO posts indicate that to up update $PATH, I should do this:

export PATH=/usr/local/opt/[email protected] :$PATH

When I do that, I get the error "`:/usr/local/opt/[email protected]': not a valid identifier", not sure where the ":" before the filepath came from.

I thin the export command only sets the php path for the current Terminal session and elsewhere on SO, I see I should add the same export command to my ~/.profile or ~/.bashrc file but neither of those files exist in my user directory (yes I am configured to see hidden files). Once the problem with the export command is resolved, should I simply create on of profile/bashrc files and add it export to the new file.

Thanks for any help, you can probably tell, I hardly everr use Terminal commands.

I've successfully installed PHP 8.1 on my OSX Catalina computer using homebrew. I can see the new version is installed in /usr/local/opt/[email protected]

Various other SO posts indicate that to up update $PATH, I should do this:

export PATH=/usr/local/opt/[email protected] :$PATH

When I do that, I get the error "`:/usr/local/opt/[email protected]': not a valid identifier", not sure where the ":" before the filepath came from.

I thin the export command only sets the php path for the current Terminal session and elsewhere on SO, I see I should add the same export command to my ~/.profile or ~/.bashrc file but neither of those files exist in my user directory (yes I am configured to see hidden files). Once the problem with the export command is resolved, should I simply create on of profile/bashrc files and add it export to the new file.

Thanks for any help, you can probably tell, I hardly everr use Terminal commands.

Share Improve this question asked Nov 20, 2024 at 0:41 PetePete 4932 gold badges7 silver badges16 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

It looks like you have a space character between @8.1 and the following colon. If you take that out, the command should work for the current shell.

You are probably running zsh rather than bash, so look for a .zshrc file and try adding your export command there.

发布评论

评论列表(0)

  1. 暂无评论