Setting up OctoPrint on MacOS

After initial installation I had error when starting server

error: [Errno 48] Address already in use

Fixed by changing port

octoprint config set server.port 5006 --int
1 Like

Hmm, can't seem to install octoprint from pip3
Inside the virtualenv, I can successfully install pyobjc
Howeveer when I run:
pip3 install OctoPrint


      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DWATCHDOG_VERSION_STRING=\"1.0.2\" -DWATCHDOG_VERSION_MAJOR=1 -DWATCHDOG_VERSION_MINOR=0 -DWATCHDOG_VERSION_BUILD=2 -I/Users/jigglwiggly/Documents/OctoPrint/venv/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -c src/watchdog_fsevents.c -o build/temp.macosx-10.9-universal2-cpython-39/src/watchdog_fsevents.o -std=c99 -pedantic -Wall -Wextra -fPIC -Wno-nullability-completeness -Wno-nullability-extension -Wno-newline-eof -Wno-error=unused-command-line-argument
      src/watchdog_fsevents.c:22:10: fatal error: 'Python.h' file not found
      #include <Python.h>
               ^~~~~~~~~~
      1 error generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  Rolling back uninstall of watchdog
  Moving to /Users/jigglwiggly/Documents/OctoPrint/venv/bin/watchmedo
   from /private/var/folders/v9/d7zxdh3524181t0n2qh4yqx40000gn/T/pip-uninstall-ajhdc3d5/watchmedo
  Moving to /Users/jigglwiggly/Documents/OctoPrint/venv/lib/python3.9/site-packages/_watchdog_fsevents.cpython-39-darwin.so
   from /private/var/folders/v9/d7zxdh3524181t0n2qh4yqx40000gn/T/pip-uninstall-c02g8c4o/_watchdog_fsevents.cpython-39-darwin.so
  Moving to /Users/jigglwiggly/Documents/OctoPrint/venv/lib/python3.9/site-packages/watchdog-2.2.0.dist-info/
   from /Users/jigglwiggly/Documents/OctoPrint/venv/lib/python3.9/site-packages/~atchdog-2.2.0.dist-info
  Moving to /Users/jigglwiggly/Documents/OctoPrint/venv/lib/python3.9/site-packages/watchdog/
   from /Users/jigglwiggly/Documents/OctoPrint/venv/lib/python3.9/site-packages/~atchdog
error: legacy-install-failure

Γ— Encountered error while trying to install package.
╰─> watchdog

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

I am on a mac mini, os 13.1
EDIT: It seems to work if I am not in a virtualenv. I am not sure why, but it seems the virtualenv is using Python 3.9 instead of 3.10...?

That might be because virtualenv just uses the 'default' Python installation on your system - I don't have a Mac to know exactly how it works, but on every other system you have to specify if you want a different version using --python=/path/to/python. None of the core contributors have a Mac as far as I know but I suspect this guide could probably be modernized. In other OS guides, they use venv instead of virtualenv, as it's built in to Python 3 & doesn't have the strange behaviour I mentioned above.

Perhaps if there is anyone out there who would like to improve the guide, it is free to edit for users at TL1 or higher.

1 Like

Anyone have the correct reboot command to get the octoprint server to reboot?

Good evening, everyone!

I'm struggling quite a bit with this issue and a friend recommended I post it here.

I followed the guide until the part where I'm supposed to install Octoprint perse.

(venv) ╭─flurin@Macbeth ~/octoprint
╰─$ pip install Octoprint
Collecting Octoprint
  Using cached OctoPrint-1.8.7-py2.py3-none-any.whl.metadata (12 kB)
Collecting OctoPrint-FileCheck>=2021.2.23 (from Octoprint)
  Using cached OctoPrint_FileCheck-2021.2.23-py2.py3-none-any.whl.metadata (1.4 kB)
Collecting OctoPrint-FirmwareCheck>=2021.10.11 (from Octoprint)
  Using cached OctoPrint_FirmwareCheck-2021.10.11-py2.py3-none-any.whl.metadata (3.9 kB)
Collecting OctoPrint-PiSupport>=2022.6.13 (from Octoprint)
  Using cached OctoPrint_PiSupport-2023.10.10-py2.py3-none-any.whl.metadata (2.9 kB)
Collecting argon2-cffi<22,>=21.3.0 (from Octoprint)
  Using cached argon2_cffi-21.3.0-py3-none-any.whl.metadata (5.4 kB)
Collecting cachelib<0.3,>=0.2 (from Octoprint)
  Using cached cachelib-0.2.0-py3-none-any.whl.metadata (2.0 kB)
Collecting Click<9,>=8.0.3 (from Octoprint)
  Using cached click-8.1.7-py3-none-any.whl.metadata (3.0 kB)
Collecting colorlog<7,>=6 (from Octoprint)
  Using cached colorlog-6.8.2-py3-none-any.whl.metadata (10 kB)
Collecting emoji<2,>=1.4.2 (from Octoprint)
  Using cached emoji-1.7.0.tar.gz (175 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Collecting feedparser<7,>=6.0.8 (from Octoprint)
  Using cached feedparser-6.0.11-py3-none-any.whl.metadata (2.4 kB)
Collecting filetype<2,>=1.0.7 (from Octoprint)
  Using cached filetype-1.2.0-py2.py3-none-any.whl.metadata (6.5 kB)
Collecting Flask-Assets<3,>=2.0 (from Octoprint)
  Using cached Flask_Assets-2.1.0-py3-none-any.whl.metadata (931 bytes)
Collecting Flask-Babel<3,>=2.0 (from Octoprint)
  Using cached Flask_Babel-2.0.0-py3-none-any.whl.metadata (2.1 kB)
Collecting Flask-Login<0.6,>=0.5 (from Octoprint)
  Using cached Flask_Login-0.5.0-py2.py3-none-any.whl.metadata (1.7 kB)
Collecting Flask-Limiter<3,>=2.6 (from Octoprint)
  Using cached Flask_Limiter-2.9.2-py3-none-any.whl.metadata (6.3 kB)
Collecting flask<2.2,>=2.1 (from Octoprint)
  Using cached Flask-2.1.3-py3-none-any.whl.metadata (3.9 kB)
Collecting frozendict<3,>=2.0 (from Octoprint)
  Using cached frozendict-2.4.0.tar.gz (314 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Collecting future<1,>=0.18.2 (from Octoprint)
  Using cached future-0.18.3.tar.gz (840 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Collecting markdown<4,>=3.2.2 (from Octoprint)
  Using cached Markdown-3.5.2-py3-none-any.whl.metadata (7.0 kB)
Collecting netaddr<0.9,>=0.8 (from Octoprint)
  Using cached netaddr-0.8.0-py2.py3-none-any.whl.metadata (4.9 kB)
Collecting netifaces<1,>=0.11 (from Octoprint)
  Using cached netifaces-0.11.0.tar.gz (30 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Collecting passlib<2,>=1.7.4 (from Octoprint)
  Using cached passlib-1.7.4-py2.py3-none-any.whl.metadata (1.7 kB)
Collecting pathvalidate<3,>=2.4.1 (from Octoprint)
  Using cached pathvalidate-2.5.2-py3-none-any.whl.metadata (11 kB)
Collecting pkginfo<2,>=1.7.1 (from Octoprint)
  Using cached pkginfo-1.10.0-py3-none-any.whl.metadata (11 kB)
Collecting psutil<6,>=5.8 (from Octoprint)
  Using cached psutil-5.9.8-cp38-abi3-macosx_11_0_arm64.whl.metadata (21 kB)
Collecting pylru<2,>=1.2 (from Octoprint)
  Using cached pylru-1.2.1-py3-none-any.whl.metadata (13 kB)
Collecting pyserial<4,>=3.4 (from Octoprint)
  Using cached pyserial-3.5-py2.py3-none-any.whl.metadata (1.6 kB)
Collecting PyYAML<6,>=5.4.1 (from Octoprint)
  Using cached PyYAML-5.4.1.tar.gz (175 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  Γ— Getting requirements to build wheel did not run successfully.
  β”‚ exit code: 1
  ╰─> [54 lines of output]
      running egg_info
      writing lib3/PyYAML.egg-info/PKG-INFO
      writing dependency_links to lib3/PyYAML.egg-info/dependency_links.txt
      writing top-level names to lib3/PyYAML.egg-info/top_level.txt
      Traceback (most recent call last):
        File "/Users/flurin/Octoprint/venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/flurin/Octoprint/venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/flurin/Octoprint/venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/6q/zxyl0zdd2_gfs_49tfh6j2wc0000gp/T/pip-build-env-2u458kdr/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/6q/zxyl0zdd2_gfs_49tfh6j2wc0000gp/T/pip-build-env-2u458kdr/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "/private/var/folders/6q/zxyl0zdd2_gfs_49tfh6j2wc0000gp/T/pip-build-env-2u458kdr/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 271, in <module>
        File "/private/var/folders/6q/zxyl0zdd2_gfs_49tfh6j2wc0000gp/T/pip-build-env-2u458kdr/overlay/lib/python3.12/site-packages/setuptools/__init__.py", line 104, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/6q/zxyl0zdd2_gfs_49tfh6j2wc0000gp/T/pip-build-env-2u458kdr/overlay/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/6q/zxyl0zdd2_gfs_49tfh6j2wc0000gp/T/pip-build-env-2u458kdr/overlay/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/private/var/folders/6q/zxyl0zdd2_gfs_49tfh6j2wc0000gp/T/pip-build-env-2u458kdr/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/private/var/folders/6q/zxyl0zdd2_gfs_49tfh6j2wc0000gp/T/pip-build-env-2u458kdr/overlay/lib/python3.12/site-packages/setuptools/dist.py", line 967, in run_command
          super().run_command(command)
        File "/private/var/folders/6q/zxyl0zdd2_gfs_49tfh6j2wc0000gp/T/pip-build-env-2u458kdr/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/private/var/folders/6q/zxyl0zdd2_gfs_49tfh6j2wc0000gp/T/pip-build-env-2u458kdr/overlay/lib/python3.12/site-packages/setuptools/command/egg_info.py", line 321, in run
          self.find_sources()
        File "/private/var/folders/6q/zxyl0zdd2_gfs_49tfh6j2wc0000gp/T/pip-build-env-2u458kdr/overlay/lib/python3.12/site-packages/setuptools/command/egg_info.py", line 329, in find_sources
          mm.run()
        File "/private/var/folders/6q/zxyl0zdd2_gfs_49tfh6j2wc0000gp/T/pip-build-env-2u458kdr/overlay/lib/python3.12/site-packages/setuptools/command/egg_info.py", line 550, in run
          self.add_defaults()
        File "/private/var/folders/6q/zxyl0zdd2_gfs_49tfh6j2wc0000gp/T/pip-build-env-2u458kdr/overlay/lib/python3.12/site-packages/setuptools/command/egg_info.py", line 588, in add_defaults
          sdist.add_defaults(self)
        File "/private/var/folders/6q/zxyl0zdd2_gfs_49tfh6j2wc0000gp/T/pip-build-env-2u458kdr/overlay/lib/python3.12/site-packages/setuptools/command/sdist.py", line 102, in add_defaults
          super().add_defaults()
        File "/private/var/folders/6q/zxyl0zdd2_gfs_49tfh6j2wc0000gp/T/pip-build-env-2u458kdr/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/sdist.py", line 251, in add_defaults
          self._add_defaults_ext()
        File "/private/var/folders/6q/zxyl0zdd2_gfs_49tfh6j2wc0000gp/T/pip-build-env-2u458kdr/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/sdist.py", line 336, in _add_defaults_ext
          self.filelist.extend(build_ext.get_source_files())
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "<string>", line 201, in get_source_files
        File "/private/var/folders/6q/zxyl0zdd2_gfs_49tfh6j2wc0000gp/T/pip-build-env-2u458kdr/overlay/lib/python3.12/site-packages/setuptools/_distutils/cmd.py", line 107, in __getattr__
          raise AttributeError(attr)
      AttributeError: cython_sources
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

Γ— Getting requirements to build wheel did not run successfully.
β”‚ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Thanks for any help! It's probably obvious to you guys but it's quantum physics for me! :smiley:

I've run into the very same problem. :grimacing: Can anyone suggest a fix?

Oops, my error was not identical...

Processing /Users/mark/OctoPrint
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  Γ— Getting requirements to build wheel did not run successfully.
  β”‚ exit code: 1
  ╰─> [28 lines of output]
      Traceback (most recent call last):
        File "/Users/mark/OctoPrint/.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/mark/OctoPrint/.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/mark/OctoPrint/.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/m5/_vbsc_l56psd5_tdvh5m2h0w0000gn/T/pip-build-env-z_9jfvyl/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/m5/_vbsc_l56psd5_tdvh5m2h0w0000gn/T/pip-build-env-z_9jfvyl/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "/private/var/folders/m5/_vbsc_l56psd5_tdvh5m2h0w0000gn/T/pip-build-env-z_9jfvyl/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 396, in <module>
        File "<string>", line 320, in params
        File "/Users/mark/OctoPrint/versioneer.py", line 1957, in get_version
          return get_versions()["version"]
                 ^^^^^^^^^^^^^^
        File "/Users/mark/OctoPrint/versioneer.py", line 1870, in get_versions
          cfg = get_config_from_root(root)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/mark/OctoPrint/versioneer.py", line 447, in get_config_from_root
          parser = configparser.SafeConfigParser()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      AttributeError: module 'configparser' has no attribute 'SafeConfigParser'. Did you mean: 'RawConfigParser'?
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

Γ— Getting requirements to build wheel did not run successfully.
β”‚ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

OctoPrint is only compatible with Python 3.12 (what you are using here) starting with version 1.10.0.

Either downgrade your Python or explicitly install the current release candidate for 1.10.0:

pip install OctoPrint==1.10.0rc4

:100: Thanks for the save! My printer is back online and working nicely on my new (old) Mac mini server.

1 Like

I'm running into a similar error as above. The "pip install OctoPrint" command runs fine until:

Collecting netifaces2<0.1,>=0.0.21 (from OctoPrint==1.10.0rc4)
Using cached netifaces2-0.0.22.tar.gz (21 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... error
error: subprocess-exited-with-error

Γ— Preparing metadata (pyproject.toml) did not run successfully.
β”‚ exit code: 1
╰─> [6 lines of output]

  Cargo, the Rust package manager, is not installed or is not on PATH.
  This package requires Rust and Cargo to compile extensions. Install it through
  the system's package manager or via https://rustup.rs/
  
  Checking for Rust toolchain....
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

Γ— Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

I installed Cargo via the instructions at that website, and got an identical error.

Versions etc.:
Mac OS Sonoma, 14.4.1 (23E224) (M3 Max)
Python: 3.12.3
Virtualenv: 20.26.1

Any suggestions? I'm about ready to chuck my printer out the window. It was a gift from a friend who knows I'm into 3d printing and it's hard to justify spending this much time on it when I can go into the work lab and print whatever I want.

Hey people,

gpt-4o developed a solution to making the restart button work on MacOS, and also allowing for autostart on boot. You can find it on this Gist here.

Have you actually personally verified these steps and that this works? Blindly trusting steps generated by a possibly hallucinating AI ain't a good idea.

1 Like

I went through multiple iterations and testing of methods it came up with, and this one works, I have tested it.

2 Likes

I am praying someone can help.
Been running Octoprint fo on my mac mini for a a few years. bullet proof.
rebooted and now cannot connect to it from another machine.

RUn Octoprint serve from command,
Read in the long list
{'base_url': 'http://0.0.0.0:5000/

I can access it via 0.0.0.0:5000 on the host mac, but other machines zip. get unable to connect.
Checked firewall, it allows terminal, python and octoprint.

Do i need to setup HAProxy? - I didnt think i did that in the past but its been a long time.
Manybe macos update wiped it out or something

From inside the LAN?

Maybe the router has assigned a different IP?

Unlikely.

Yes from inside the LAN, i.e. another machine. - IP still the same checked with ipconfig getifaddr en0

the machine is running MACOS 12 (as its a late 2014 model) - when I reinstall brew it told me that 12 is no longer supported too.

Also I couldnt get sudo homebrew services start haproxy to work it just says command not found
I used sudo brew services start haproxy which seemed to work but still not fixed anything

I have ordered a PI 4b to move to as there seems to be more guides etc

i heve the same error code but i am using 3.13

Python 3.13 was released on October 7th, that was a week ago. It is not yet supported by the current stable version of OctoPrint (1.10.2) as released on June 18th. You may always consult the README, which will tell you what versions are supported. At the time of writing it states:

OctoPrint currently supports Python 3.7, 3.8, 3.9, 3.10, 3.11 and 3.12.

In general, if OctoPrint tells you it doesn't support your python version, that's not a bug, that's due to your Python version being too old (upgrade) or due to it being too new (wait and/or use the one before). With the available development resources (one full time dev, me, hi) it doesn't make sense to try to hit a moving target, so testing and necessary changes only happen once a stable release of a new Python version is out. It's tricky enough to support a large range as the above as is.