{"id":3630,"date":"2026-07-23T00:02:24","date_gmt":"2026-07-22T16:02:24","guid":{"rendered":"https:\/\/blog.zengqq.com.cn\/?p=3630"},"modified":"2026-07-23T00:22:27","modified_gmt":"2026-07-22T16:22:27","slug":"%e5%85%b3%e4%ba%8eollama%e4%b8%8d%e6%98%be%e7%a4%ba%e5%a4%a7%e6%a8%a1%e5%9e%8b%e7%9a%84%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"https:\/\/blog.zengqq.com.cn\/?p=3630","title":{"rendered":"\u5173\u4e8eollama\u4e0d\u663e\u793a\u5927\u6a21\u578b\u7684\u95ee\u9898"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u6211\u7684\u95ee\u9898\u5f88\u7b80\u5355\uff0c\u5c31\u662fmacOS\u91cc\u9762\u8fd0\u884c\u7684ollama\u4e0d\u80fd\u663e\u793a\u6a21\u578b\uff0c\u8fd9\u65f6\u56e0\u4e3aollama\u9ed8\u8ba4\u672c\u5730\u8bbf\u95ee\uff0c\u6240\u4ee5\u76d1\u542c\u5730\u5740\u662f127.0.0.1\uff1b\u4e3a\u4e86\u5f00\u653e\u5916\u7f51\u8bbf\u95ee\uff0c\u9700\u8981\u76d1\u542c0.0.0.0<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6211\u7528 \u201cbrew services start ollama\u201d \u542f\u52a8\u5728stop\uff0c\u4f46\u662f\u6ca1\u770b\u5230\u6709~\/Library\/LaunchAgents\/homebrew.mxcl.ollama.plist\uff0c\u5982\u679c\u6211\u60f3zqq\u5f00\u673a\u542f\u52a8ollama\u5e76\u76d1\u542c0.0.0.0\uff0c\u5e94\u8be5\u600e\u4e48\u529e<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5df2\u7ecf\u5b8c\u6210\u601d\u8003<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u627e\u4e0d\u5230 <code>plist<\/code> \u6587\u4ef6\u662f<strong>\u6b63\u5e38\u73b0\u8c61<\/strong>\u3002\u56e0\u4e3a\u5f53\u60a8\u6267\u884c <code>brew services stop ollama<\/code> \u65f6\uff0cHomebrew \u4f1a\u81ea\u52a8\u6e05\u7406\u5e76\u5220\u9664\u5b83\u751f\u6210\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u4ee5\u53d6\u6d88\u5f00\u673a\u81ea\u542f\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u65e2\u7136 <code>brew services<\/code> \u751f\u6210\u7684\u6587\u4ef6\u4f1a\u88ab\u6e05\u7406\uff0c\u4e14\u672a\u6765\u5347\u7ea7 Ollama \u65f6\u4e5f\u53ef\u80fd\u88ab\u8986\u76d6\uff0c<strong>\u6700\u5b8c\u7f8e\u3001\u6700\u4e00\u52b3\u6c38\u9038\u7684\u505a\u6cd5\u662f\uff1a\u624b\u52a8\u521b\u5efa\u4e00\u4e2a\u5c5e\u4e8e\u60a8\u81ea\u5df1\u7684 LaunchAgent \u914d\u7f6e\u6587\u4ef6\u3002<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u6837\u65e2\u4e0d\u4f1a\u88ab Homebrew \u5e72\u6270\uff0c\u53c8\u80fd\u5b8c\u7f8e\u6ce8\u5165 <code>0.0.0.0<\/code> \u76d1\u542c\u914d\u7f6e\u3002\u8bf7\u6309\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. \u786e\u8ba4 ollama \u7684\u7edd\u5bf9\u8def\u5f84<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u7ec8\u7aef\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff0c\u8bb0\u4f4f\u8f93\u51fa\u7684\u8def\u5f84\uff08\u901a\u5e38\u662f <code>\/opt\/homebrew\/bin\/ollama<\/code> \u6216 <code>\/usr\/local\/bin\/ollama<\/code>\uff09\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">which ollama<canvas width=\"0\" height=\"42\"><\/canvas><canvas width=\"0\" height=\"42\"><\/canvas><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2. \u521b\u5efa\u81ea\u5b9a\u4e49\u542f\u52a8\u914d\u7f6e\u6587\u4ef6<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f7f\u7528 <code>nano<\/code> \u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u914d\u7f6e\u6587\u4ef6\uff08\u540d\u5b57\u81ea\u5b9a\u4e49\uff0c\u907f\u514d\u548c brew \u51b2\u7a81\uff09\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">nano ~\/Library\/LaunchAgents\/com.zqq.ollama.plist<canvas width=\"0\" height=\"54\"><\/canvas><canvas width=\"0\" height=\"54\"><\/canvas><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3. \u586b\u5165\u914d\u7f6e\u5185\u5bb9<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5c06\u4ee5\u4e0b\u5185\u5bb9\u7c98\u8d34\u8fdb\u53bb\u3002<strong>\u6ce8\u610f\uff1a\u8bf7\u5c06\u7b2c 11 \u884c\u7684 <code>\/opt\/homebrew\/bin\/ollama<\/code> \u66ff\u6362\u4e3a\u60a8\u5728\u7b2c 1 \u6b65\u4e2d\u83b7\u53d6\u7684\u5b9e\u9645\u8def\u5f84\uff01<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?><br>&lt;!DOCTYPE plist PUBLIC \"-\/\/Apple\/\/DTD PLIST 1.0\/\/EN\" \"http:\/\/www.apple.com\/DTDs\/PropertyList-1.0.dtd\"><br>&lt;plist version=\"1.0\"><br>&lt;dict><br>    &lt;key>Label&lt;\/key><br>    &lt;string>com.zqq.ollama&lt;\/string><br>    <br>    &lt;key>ProgramArguments&lt;\/key><br>    &lt;array><br>        &lt;!-- \u66ff\u6362\u4e3a\u60a8\u5b9e\u9645\u7684 ollama \u8def\u5f84 --><br>        &lt;string>\/opt\/homebrew\/bin\/ollama&lt;\/string><br>        &lt;string>serve&lt;\/string><br>    &lt;\/array><br>    <br>    &lt;key>EnvironmentVariables&lt;\/key><br>    &lt;dict><br>        &lt;key>OLLAMA_HOST&lt;\/key><br>        &lt;string>0.0.0.0&lt;\/string><br>    &lt;\/dict><br>    <br>    &lt;key>RunAtLoad&lt;\/key><br>    &lt;true\/><br>    <br>    &lt;key>KeepAlive&lt;\/key><br>    &lt;true\/><br>    <br>    &lt;key>StandardOutPath&lt;\/key><br>    &lt;string>\/tmp\/ollama.zqq.log&lt;\/string><br>    &lt;key>StandardErrorPath&lt;\/key><br>    &lt;string>\/tmp\/ollama.zqq.error.log&lt;\/string><br>&lt;\/dict><br>&lt;\/plist><canvas width=\"0\" height=\"1356\"><\/canvas><canvas width=\"0\" height=\"1356\"><\/canvas><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><em>(\u4fdd\u5b58\u5e76\u9000\u51fa\uff1a\u6309 <code>Ctrl+O<\/code> \u56de\u8f66\u4fdd\u5b58\uff0c<code>Ctrl+X<\/code> \u9000\u51fa)<\/em><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4. \u52a0\u8f7d\u5e76\u542f\u52a8\u670d\u52a1<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f7f\u7528 macOS \u539f\u751f\u7684 <code>launchctl<\/code> \u547d\u4ee4\u52a0\u8f7d\u8be5\u914d\u7f6e\uff08<code>-w<\/code> \u53c2\u6570\u8868\u793a\u6c38\u4e45\u751f\u6548\uff0c\u5f00\u673a\u81ea\u542f\uff09\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">launchctl load -w ~\/Library\/LaunchAgents\/com.zqq.ollama.plist<canvas width=\"0\" height=\"42\"><\/canvas><canvas width=\"0\" height=\"42\"><\/canvas><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">5. \u9a8c\u8bc1\u662f\u5426\u6210\u529f<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u68c0\u67e5\u7aef\u53e3\u662f\u5426\u5df2\u7ecf\u6309 <code>0.0.0.0<\/code> \u76d1\u542c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">lsof -i :11434<canvas width=\"0\" height=\"42\"><\/canvas><canvas width=\"0\" height=\"42\"><\/canvas><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c\u770b\u5230 <code>*:11434<\/code> \u6216 <code>0.0.0.0:11434<\/code>\uff0c\u8bf4\u660e\u914d\u7f6e\u5b8c\u7f8e\u751f\u6548\uff01<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\ud83d\udca1 \u540e\u7eed\u7ba1\u7406\u6307\u5357\uff08\u4e0d\u518d\u4f7f\u7528 brew services\uff09<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u56e0\u4e3a\u73b0\u5728\u662f\u7531 macOS \u539f\u751f\u63a5\u7ba1\uff0c\u4ee5\u540e\u7ba1\u7406\u5b83\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u505c\u6b62\u670d\u52a1<\/strong>\uff1a<code>launchctl unload ~\/Library\/LaunchAgents\/com.zqq.ollama.plist<\/code><\/li>\n\n\n\n<li><strong>\u91cd\u542f\u670d\u52a1<\/strong>\uff1a\u5148 <code>unload<\/code> \u518d <code>load<\/code>\uff0c\u6216\u8005\u76f4\u63a5 <code>killall ollama<\/code>\uff08\u56e0\u4e3a\u914d\u7f6e\u4e86 <code>KeepAlive<\/code>\uff0c\u5b83\u4f1a\u81ea\u52a8\u91cd\u542f\u5e76\u91cd\u65b0\u52a0\u8f7d\u914d\u7f6e\uff09\u3002<\/li>\n\n\n\n<li><strong>\u67e5\u770b\u65e5\u5fd7<\/strong>\uff1a<code>tail -f \/tmp\/ollama.zqq.log<\/code><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u6211\u7684\u95ee\u9898\u5f88\u7b80\u5355\uff0c\u5c31\u662fmacOS\u91cc\u9762\u8fd0\u884c\u7684ollam [&#8230;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[89],"tags":[],"class_list":["post-3630","post","type-post","status-publish","format-standard","hentry","category-live"],"_links":{"self":[{"href":"https:\/\/blog.zengqq.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/3630","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.zengqq.com.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.zengqq.com.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.zengqq.com.cn\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.zengqq.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3630"}],"version-history":[{"count":1,"href":"https:\/\/blog.zengqq.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/3630\/revisions"}],"predecessor-version":[{"id":3631,"href":"https:\/\/blog.zengqq.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/3630\/revisions\/3631"}],"wp:attachment":[{"href":"https:\/\/blog.zengqq.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3630"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.zengqq.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3630"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.zengqq.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3630"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}