[GH-ISSUE #977] connect: can't assign requested address & $HOME variable not defined #477

Closed
opened 2026-04-12 10:09:25 -05:00 by GiteaMirror · 5 comments
Owner

Originally created by @tyhallcsu on GitHub (Nov 2, 2023).
Original GitHub issue: https://github.com/ollama/ollama/issues/977

% ollama run llama2
Error: Head "http://127.0.0.1:11434/": dial tcp 127.0.0.1:11434: connect: can't assign requested address

/opt/homebrew/var/log/ollama.log
Log file states:

Error: $HOME is not defined
Error: Head "http://127.0.0.1:11434/": dial tcp 127.0.0.1:11434: connect: can't assign requested address

But when I run echo $HOME i get

% echo $HOME
/Users/myusername

So what do I need to do to fix this? I even checked that the home variable was accessible from CPP enviornment using this script:

#include <cstdlib>
#include <iostream>

int main() {
    const char* homeDir = getenv("HOME");
    if (homeDir) {
        std::cout << "The HOME directory is: " << homeDir << std::endl;
    } else {
        std::cout << "The HOME environment variable is not set." << std::endl;
    }
    return 0;
}

and it returned my $HOME variable just fine

Originally created by @tyhallcsu on GitHub (Nov 2, 2023). Original GitHub issue: https://github.com/ollama/ollama/issues/977 ``` % ollama run llama2 Error: Head "http://127.0.0.1:11434/": dial tcp 127.0.0.1:11434: connect: can't assign requested address ``` `/opt/homebrew/var/log/ollama.log` Log file states: ``` Error: $HOME is not defined Error: Head "http://127.0.0.1:11434/": dial tcp 127.0.0.1:11434: connect: can't assign requested address ``` But when I run echo $HOME i get ``` % echo $HOME /Users/myusername ``` So what do I need to do to fix this? I even checked that the home variable was accessible from CPP enviornment using this script: ``` #include <cstdlib> #include <iostream> int main() { const char* homeDir = getenv("HOME"); if (homeDir) { std::cout << "The HOME directory is: " << homeDir << std::endl; } else { std::cout << "The HOME environment variable is not set." << std::endl; } return 0; } ``` and it returned my $HOME variable just fine
Author
Owner

@tyhallcsu commented on GitHub (Nov 2, 2023):

UPDATE:
I think the issue is that I had the brew version and the .app version installed concurrently and that caused collisions

<!-- gh-comment-id:1791670305 --> @tyhallcsu commented on GitHub (Nov 2, 2023): UPDATE: I think the issue is that I had the brew version and the .app version installed concurrently and that caused collisions
Author
Owner

@tyhallcsu commented on GitHub (Nov 2, 2023):

UPDATE: I think the issue is that I had the brew version and the .app version installed concurrently and that caused collisions

Nope. Still broken lol

<!-- gh-comment-id:1791673680 --> @tyhallcsu commented on GitHub (Nov 2, 2023): > UPDATE: I think the issue is that I had the brew version and the .app version installed concurrently and that caused collisions Nope. Still broken lol
Author
Owner

@igorschlum commented on GitHub (Nov 2, 2023):

Hello tyhallcsu,
When I type in terminal (MacOS)
% ollama run llama2
I get the normal >>> prompt.
and when I type "http://127.0.0.1:11434/" in Safari, I have the message : Ollama is running
I cannot reproduce the issue you describe.

<!-- gh-comment-id:1791700410 --> @igorschlum commented on GitHub (Nov 2, 2023): Hello tyhallcsu, When I type in terminal (MacOS) % ollama run llama2 I get the normal >>> prompt. and when I type "http://127.0.0.1:11434/" in Safari, I have the message : Ollama is running I cannot reproduce the issue you describe.
Author
Owner

@tyhallcsu commented on GitHub (Nov 3, 2023):

Hello tyhallcsu, When I type in terminal (MacOS) % ollama run llama2 I get the normal >>> prompt. and when I type "http://127.0.0.1:11434/* " in Safari, I have the message : Ollama is running I cannot reproduce the issue you describe.

The error log just has "Error: $HOME is not defined"
Is there any reason ollama isnt able to read my env variables?

<!-- gh-comment-id:1791961443 --> @tyhallcsu commented on GitHub (Nov 3, 2023): > Hello tyhallcsu, When I type in terminal (MacOS) % ollama run llama2 I get the normal >>> prompt. and when I type "http://127.0.0.1:11434/* " in Safari, I have the message : Ollama is running I cannot reproduce the issue you describe. The error log just has "Error: $HOME is not defined" Is there any reason ollama isnt able to read my env variables?
Author
Owner

@tyhallcsu commented on GitHub (Nov 3, 2023):

Update, I fixed it using this command:

sudo ifconfig lo0 alias 127.0.0.1/8

It was running on 0.0.0.0 only, but not accessible because I didnt have a loopback alias for 127.0.0.1

<!-- gh-comment-id:1791981995 --> @tyhallcsu commented on GitHub (Nov 3, 2023): **Update, I fixed it using this command:** `sudo ifconfig lo0 alias 127.0.0.1/8` It was running on 0.0.0.0 only, but not accessible because I didnt have a loopback alias for 127.0.0.1
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#477