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

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?