本质逻辑:SearxNG 核心就是一个 Python 应用,我们用 Homebrew 装依赖 + Python venv 直接跑在你的用户目录下(不创建系统用户、不用 uWSGI),资源占用最低(适合 8GB 内存老 Mac)。后期用 launchd 做后台服务,开机自启。 完整一步步安装(复制粘贴执行) 安装系统依赖(Homebrew,一次性):Bashbrew update brew install python@3.11 git libxslt libxml2 openssl pkg-config 克隆 SearxNG 仓库(放到家目录,方便管理):Bashcd ~ git clone https://github.com/searxng/searxng.git searxng cd searxng 创建并激活 Python 虚拟环境(隔离依赖):Bashpython3.11 -m venv ~/searxng-venv source ~/searxng-venv/bin/activate 安装 SearxNG 及其依赖:Bashpip install --upgrade pip setuptools wheel pip install --use-pep517 --no-build-isolation -e . pip install gunicorn # 用于生产运行,比 python webapp 稳定 生成配置文件:Bashmkdir -p ~/searxng-settings cp utils/templates/etc/searxng/settings.yml ~/searxng-settings/settings.yml 生成随机 secret_key(必须做,否则无法启动):Bashsed -i '' "s/ultrasecretkey/$(openssl rand -hex 16)/g" ~/searxng-settings/settings.yml 测试启动(开发模式,先验证是否能跑):Bashexport SEARXNG_SETTINGS_PATH=~/searxng-settings/settings.yml python searx/webapp.py 浏览器打开 http://127.0.0.1:8888 测试搜索(能用就成功)。 按 Ctrl+C 停止。 推荐生产运行方式(后台稳定) 用 gunicorn 启动(比 webapp.py 更稳): Bashgunicorn -w 2 --bind 127.0.0.1:8080 --chdir ~/searxng searx.webapp:app 做成开机自启服务(launchd)(推荐): 创建 plist 文件:Bashnano ~/Library/LaunchAgents/io.searxng.plist粘贴以下内容(保存退出):XML Label io.searxng ProgramArguments /Users/zhan940/searxng-venv/bin/gunicorn -w 2 --bind 127.0.0.1:8080 --chdir /Users/zhan940/searxng searx.webapp:app EnvironmentVariables SEARXNG_SETTINGS_PATH /Users/zhan940/searxng-settings/settings.yml RunAtLoad KeepAlive 加载服务:Bashlaunchctl load ~/Library/LaunchAgents/io.searxng.plist 检查状态:Bashlaunchctl list | grep searxng