Change of web 8080 port number?

I am temporarily setting up OH on a Mac Mini but it already runs other web applications so that 8080 and 80 are not available. I can’t see how to change the port number. I found a post suggesting that it is in the or jetty files but I’ve not seen it yet.

Can someone point me in the right place please.

Uncomment and edit /etc/default/openhab2

## The ports openHAB will bind its HTTP/HTTPS web server to.


I’m running on a Mac so I just unzipped the files.

I don’t seem to have that folder structure for that reason. I did add some
environment variables to the without success so far.


Then you need to search for a “manual” install solution…

I did follow the instructions for MacOS install. Are you suggesting there is another approach for Mac ?

Unzipping the files is called a “manual” install versus an apt install:

So you need to find the answer to your question for the “manual” installation method.

Ok - maybe I’m missing something.

I am installing on a Mac Mini running MacOS High Sierra.

The very first line of manual installation does not work on MacOs

sudo adduser --system --no-create-home --group --disabled-login openhab

sudo: adduser: command not found

No, you just misunderstood my answer. The link is an example for a manual installation method. It is not an answer to your initial question.
You need to search for a solution to change the port on the manual installation method.

Found nothing in “manual install” section.

Searched for 8080 string in all the files and there is a setenv command file which looks for envariable

However when I tried to set that in the startup script it did not seem to help.

Never mind - had plenty of debugging today with the raspberry pi option which crashes on shutdown when running of a SSD. Plain rasberrian stretch does not do this.

Maybe that will get sorted before this. I need to keep the other applications running on their existing ports for now.

Thanks Dave

OK - so can someone give me a hand getting openHab to run off alternative web ports please. I’m running on MacOs and I’ve tried setting the alternative port numbers as enviroment variables in the file.



Using the search button it comes up with:

Yes - those are the environment variables I changed - didn’t seem to have any effect.

My startup command file now looks like


echo Launching the openHAB runtime…


DIRNAME=dirname "$0"
exec “${DIRNAME}/runtime/bin/karaf” “${@}”

However the browser says it cannot connect to it - even via localhost.

In fact 8080 still works as before

What about:

Hi @Dave_G1,

How did you previously set your environment variables?

If you’re using a script to set them, they must be exported.


echo Launching the openHAB runtime…


DIRNAME=dirname "$0"
exec “${DIRNAME}/runtime/bin/karaf” “${@}”

If this works, then you’ll need to find the correct environment to set. I’m not very familar with macos, but I believe globally applied environment variables can be set in /etc/launchd.conf


That sounds like a good idea - I will give it a try and let you know.


Adding this here to maybe help other new users (like myself).

Had the same problem on a Windows 8.1 machine. Could not get to the Web UI using http://localhost:8080. Realized/remembered that I have security camera software that uses that port – which I preferred to not have to change.

Could not find anywhere how to change the Openhab port on Windows. Here’s what finally worked (at least when running OpenHAB2 as a service):

Open/edit “C:\OpenHab2\userdata\etc\ openHAB2-wrapper.conf”

Add the following two lines just below “set.default.OPENHAB_HOME=C:\OpenHab2”:


The following may or may not be necessary (I have not yet confirmed if it is needed or not but I made this change it is working when run as a service):

Open/edit “C:\OpenHab2\runtime\bin\setenv.bat”
change to:

Then, follow setup/install instructions:

Using: “zulu8.28.0.1-jdk8.0.163-win_x64” (default installation is Program Files directory).

Have not done further testing but initially the above did not seem to work when running the start.bat script but did work when running as a service. Changing only the setenv.bat entry alone did not work by itself, which is why I concluded it may not be necessary at all to run s a service.

For anyone looking for that, the port is defined in the folde
runtime/bin/setenv (setenv.bat for Windows).

Warning though, if you change that file, it will revert on next upgrade. It’s better to changeit with export on linux and other supported ways.

1 Like