[GH-ISSUE #8265] The Mac version cannot customize the listening port #5284

Closed
opened 2026-04-12 16:27:47 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @Sze-chwan-er on GitHub (Dec 29, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/8265

What is the issue?

On Mac computers with the Apple chip, it is not possible to change the default listening port of ollama. Even I stoped ollama before I changed it. Attempting to change the listening port using the following commands as a regular user and an administrator does not work: OLLAMA_HOST=0.0.0.0:11434. The port that ollama listens still islocalhost:11434, which prevents other computer devices in the local network from accessing the ollama service.

OS

macOS

GPU

Apple

CPU

Apple

Ollama version

0.5.4

Originally created by @Sze-chwan-er on GitHub (Dec 29, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/8265 ### What is the issue? On Mac computers with the Apple chip, it is not possible to change the default listening port of ollama. Even I stoped ollama before I changed it. Attempting to change the listening port using the following commands as a regular user and an administrator does not work: `OLLAMA_HOST=0.0.0.0:11434`. The port that ollama listens still is`localhost:11434`, which prevents other computer devices in the local network from accessing the ollama service. ### OS macOS ### GPU Apple ### CPU Apple ### Ollama version 0.5.4
GiteaMirror added the needs more infobug labels 2026-04-12 16:27:47 -05:00
Author
Owner

@Sze-chwan-er commented on GitHub (Dec 29, 2024):

bug
<!-- gh-comment-id:2564690107 --> @Sze-chwan-er commented on GitHub (Dec 29, 2024): <img width="789" alt="bug" src="https://github.com/user-attachments/assets/b32be2d5-a9be-4341-87ae-7949342b58a0" />
Author
Owner

@rick-github commented on GitHub (Dec 29, 2024):

Where are you modifying this variable? Server logs may aid in debugging.

<!-- gh-comment-id:2564691417 --> @rick-github commented on GitHub (Dec 29, 2024): Where are you modifying this variable? [Server logs](https://github.com/ollama/ollama/blob/main/docs/troubleshooting.md#how-to-troubleshoot-issues) may aid in debugging.
Author
Owner

@pdevine commented on GitHub (Dec 30, 2024):

@Sze-chwan-er I'm not quite sure what you're trying to do. Is it change the default port to something else? Is it to open the firewall on your Mac to allow other systems to connect?

To change the port. use the OLLAMA_HOST environment variable. There are directions to change it in the FAQ, but it will look something like:

launchctl setenv OLLAMA_HOST "0.0.0.0:11435"

To then connect to it with the client use something like:

OLLAMA_HOST=127.0.0.1:11435 ollama run llama3.2

Substitute 127.0.0.1 with the IP address of the host. You may also be using a firewall on your computer and will need to change the settings. Here's a link to a doc on how to change your Mac Firewall.

I think I've answered your question, but I'll leave the issue open for a little bit.

<!-- gh-comment-id:2564884397 --> @pdevine commented on GitHub (Dec 30, 2024): @Sze-chwan-er I'm not quite sure what you're trying to do. Is it change the default port to something else? Is it to open the firewall on your Mac to allow other systems to connect? To change the port. use the `OLLAMA_HOST` environment variable. There are directions to change it in the [FAQ](https://github.com/ollama/ollama/blob/main/docs/faq.md#setting-environment-variables-on-mac), but it will look something like: ```bash launchctl setenv OLLAMA_HOST "0.0.0.0:11435" ``` To then connect to it with the client use something like: ```bash OLLAMA_HOST=127.0.0.1:11435 ollama run llama3.2 ``` Substitute `127.0.0.1` with the IP address of the host. You may also be using a firewall on your computer and will need to change the settings. [Here's a link to a doc on how to change your Mac Firewall](https://support.apple.com/guide/mac-help/change-firewall-settings-on-mac-mh11783/mac). I think I've answered your question, but I'll leave the issue open for a little bit.
Author
Owner

@Sze-chwan-er commented on GitHub (Dec 30, 2024):

@Sze-chwan-er I'm not quite sure what you're trying to do. Is it change the default port to something else? Is it to open the firewall on your Mac to allow other systems to connect?

To change the port. use the OLLAMA_HOST environment variable. There are directions to change it in the FAQ, but it will look something like:

launchctl setenv OLLAMA_HOST "0.0.0.0:11435"

To then connect to it with the client use something like:

OLLAMA_HOST=127.0.0.1:11435 ollama run llama3.2

Substitute 127.0.0.1 with the IP address of the host. You may also be using a firewall on your computer and will need to change the settings. Here's a link to a doc on how to change your Mac Firewall.

I think I've answered your question, but I'll leave the issue open for a little bit.

I did not open firewall. And if I run python http.server at 11434port, everything is ok. By the way, your methods is work! Cool~

<!-- gh-comment-id:2565022647 --> @Sze-chwan-er commented on GitHub (Dec 30, 2024): > @Sze-chwan-er I'm not quite sure what you're trying to do. Is it change the default port to something else? Is it to open the firewall on your Mac to allow other systems to connect? > > To change the port. use the `OLLAMA_HOST` environment variable. There are directions to change it in the [FAQ](https://github.com/ollama/ollama/blob/main/docs/faq.md#setting-environment-variables-on-mac), but it will look something like: > > ```shell > launchctl setenv OLLAMA_HOST "0.0.0.0:11435" > ``` > > To then connect to it with the client use something like: > > ```shell > OLLAMA_HOST=127.0.0.1:11435 ollama run llama3.2 > ``` > > Substitute `127.0.0.1` with the IP address of the host. You may also be using a firewall on your computer and will need to change the settings. [Here's a link to a doc on how to change your Mac Firewall](https://support.apple.com/guide/mac-help/change-firewall-settings-on-mac-mh11783/mac). > > I think I've answered your question, but I'll leave the issue open for a little bit. I did not open firewall. And if I run python http.server at 11434port, everything is ok. By the way, your methods is work! Cool~
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#5284