- 主题:请教一下MAC怎么保存环境变量? (转载)
【 以下文字转载自 NewExpress 讨论区 】
发信人: SuLiang (家有胖娃一枚,胖!), 信区: NewExpress
标 题: 请教一下MAC怎么保存环境变量?
发信站: 水木社区 (Sat Feb 8 22:45:48 2025), 站内
之前配置ollama有两个变量要设置
但是重启电脑后有得重新设置,请问有没有保存环境变量的方法?
多谢
launchctl setenv OLLAMA_HOST "0.0.0.0"
launchctl setenv OLLAMA_ORIGINS "*"
--
FROM 222.131.24.*
On macOS
Setting up environment variables on macOS can be done using the
launchctl
command:
Open your terminal.
Use the following command to set a variable:
bash
launchctl setenv OLLAMA_HOST "0.0.0.0"
Restart the Ollama application to apply changes.
If you want these changes to persist across reboots, consider adding them to your shell configuration file (like
.bash_profile
or
.zshrc
) in the form of:
bash
export OLLAMA_HOST="0.0.0.0"
Make sure to source your file afterward:
bash
source ~/.bash_profile
【 在 SuLiang 的大作中提到: 】
: 【 以下文字转载自 NewExpress 讨论区 】
: 发信人: SuLiang (家有胖娃一枚,胖!), 信区: NewExpress
: 标 题: 请教一下MAC怎么保存环境变量?
: ...................
--
FROM 123.196.11.*
存了
echo也能看到
但是不起作用。。。重启后手工输入指令才起作用。。。
launchctl setenv OLLAMA_HOST "0.0.0.0"
launchctl setenv OLLAMA_ORIGINS "*"
【 在 WorldRoamer 的大作中提到: 】
: On macOS
: Setting up environment variables on macOS can be done using the
: launchctl
: ...................
--
FROM 222.131.24.*
写个批处理启动终端:)
【 在 SuLiang 的大作中提到: 】
: 存了
: echo也能看到
: 但是不起作用。。。重启后手工输入指令才起作用。。。
: ...................
--
FROM 112.44.127.*