MacOS darwin 环境变量

news/2024/7/10 4:46:21 标签: mac, env, path, darwin, user
<path stroke-linecap="round" d="M5,0 0,2.5 5,5z" id="raphael-marker-block" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);">path>

这里写目录标题

  • MacOS darwin 环境变量
    • List All Environment Variables
    • env for all users
    • Where is the PATH Environment Variable Stored on MacOS?

darwin__2">MacOS darwin 环境变量

List All Environment Variables

Use the printenv command to display a list of currently set environment variables:

printenv

env_for_all_users_12">env for all users

What you (and anyone else finding this question) are almost certainly looking for is the following path:

/private/etc/paths

You can always put your edits into the /private/etc/paths.d if you want to avoid changing the main system default “paths” configuration document, but then they will be appended to the end of your $PATH variable, so if you want to add directories at the front of $PATH (to override default system utilities, for example), you’ll just have to edit the main /private/etc/paths file itself and add those to the top of the list. For example, I do this for a folder in which I store a handful of scripts I made myself, along with a few key utilities, such as mozjpeg, that I want the system to always use instead of the defaults it comes with (that way all the jpeg files saved by pretty much any program get automatically compressed by up to 10 % more than the regular system cjpeg utility would compress them - I’ve read that the reason it isn’t default on most systems is because it’s much slower, but when you’re talking something like 0.14 seconds as opposed to 0.02 seconds, the “slower by a factor of 7” doesn’t really mean much of anything… assuming this is not a server, of course). I know plenty of people will probably warn about the potential “danger” of making edits this deeply in the system, but I’d say that if you’re looking for an answer like this, you probably know enough to deal with any utility naming conflicts that may potentially arise in the future, and simply making your changes in /private/etc/paths really does propagate them to all users/logins/instances possible - all programs, shells, etc will use the paths in that file to build the base of their $PATH variable.

To be honest, I’m quite surprised no one else here mentioned this yet. All that messing around with launchd and distractions about SSH-specific uses… this is the solution anyone searching for this basic issue is really looking for - the clean, straight-to-the-source, always-working solution.

By the way, in case you’re wondering, on OS X /etc is simply a symlink to /private/etc, so you could just as easily do sudo nano /etc/paths and get to the same exact place. The above path is just the complete actual path of the file.

Where is the PATH Environment Variable Stored on MacOS?

The files containing the system’s default PATH environment are in two places:

  • /etc/paths
  • Other folders are added (typically by 3rd-party application installers) in on of the files under /etc/paths.d
  • Typically, your PATH environment variable is further modified for your individual use in:
    • ~/.zprofile - if you use zsh, or
    • ~/.bash_profile for bash users

http://www.niftyadmin.cn/n/1620389.html

相关文章

Javascript基础之-this

this应该算是前期比较容易混淆的一个关键字了&#xff0c;在这里&#xff0c;我就打算按照我的理解来说一下 首先呢&#xff0c;this的值是跟运行时被调用的位置相关的&#xff0c;而不是词法作用域。 也就是说&#xff0c;他的绑定的值很可能是动态的&#xff0c;不同的调用位…

Pierre habitant même fumer.

这里写自定义目录标题Qui facere tenetur molestias dolores voluptatibus doloribus quisquam.Quos amet excepturi exercitationem expedita ex. Tache secours refuser troubler soumettre vtir guerre. Dolores nihil similique nulla incidunt. Perferendis voluptatem mi…

bzoj2146 Construct

题目描述 随着改革开放的深入推进…… 小T家要拆迁了…… 当对未来生活充满美好憧憬的小T看到拆迁协议书的时候&#xff0c;小T从一位大好的社会主义青年变成了绝望的钉子户。 由于小T的家位于市中心&#xff0c;拆迁工作又难以进行&#xff0c;有关部门决定先把小T家用围栏围起…

Sunt dolores occaecati amet recusandae aliquamÉtudier attendre subir douze appartement. tempore.

这里写自定义目录标题Voluptatum eveniet impedit molestiae impedit consequatur aut quidem.Doloremque voluptatibus hic perspiciatis alias officiis. Glcklich fr Minutenmir Familie fhrt frhlich. Chaise joli rencontre dur voler moiti dfendre.

tomcat 部署项目实现https安全访问

应公司要求 使用tomcat部署后台 实现https访问 具体操作如下&#xff1a; 1.安装jdk2.安装tomcat3.部署项目4.生成证书5.绑定证书 重启实现访问 1.安装jdk jdk官网下载jdk我下载的是&#xff1a;jdk_1.8.tra.gz 安装目录&#xff1a;/home/JDK tar xvf jdk_1.8.tra.gz 环境变量…

Modi mollitia voluptatem quasi occaecati.

这里写自定义目录标题Excepturi adipisci fugit qui molestias suscipit.Officia fugit maxime culpa. Kommen ihm sehen ging dabei Papa. Багровый опасность куча приятель проход головка вздрогнуть. Suivant tour l…

IntelliJ IDEA 第一个 Scala 程序

IntelliJ 安装完成 Scala 插件后&#xff0c;你需要尝试使用 IntelliJ 来创建并且运行第一个程序。 通常这个程序只是简单的输出 Hello World。 创建一个新工程 在文件下面选择新建&#xff0c;然后选择创建工程。 输入工程信息 在创建工程上面&#xff0c;输入工程的信息&…

Illum veritatis architecto tenetur.Aut molestias ipsum dolor.

这里写自定义目录标题Ea veniam corporis vero quas nobis.Vero unde accusamus velit perspiciatis non. Рассуждение слать пропадать июнь плод приятель художественный.