Init.d service script for OS X ?

Sorry for the recent posts. This one might be easier to answer.

I’ve been able to use the init.d script provided on the WIKI here

That works great with UBUNTU.

I am looking for something similar for OS X, mostly because I do most of my dev work on OS X initially because it is much more convenient for me sometimes.

I’m working on an Admin Control Panel using PHP and I’d like to be able to start and stop Orthanc remotely using the init.d script. That works with the Debian script, but I need an equivalent .sh script or daemon that I can use for OS X.

I’ve looked around a little and there isn’t much on the internet.


and it probably varies a bit for OS X release version since it changes periodically from version to version.

I know that they often use .plist files.

A .sh script like this works, but that just starts it up from the terminal, not in the background of as a service / daemon.


cd “$(dirname “$0”)”

script name is, put it in the same directory as the Orthanc executable. e.g. /path/to/orthanc/Orthanc/

/Users/sscotti/Desktop/orthancAndPluginsOSX.stable/ to execute from the command line, for my install

cd /Users/sscotti/Desktop/orthancAndPluginsOSX.stable #Directory for the executable Orthanc
./Orthanc ConfigOSX.json --verbose #ConfigOSX.json is in the same directory, although can probably have that somewhere else.



MacOs uses launchd to control startup agents and daemons. Here are a few links that may help

My recommendation is to use docker on a Mac. You get to use the prebuilt Osimis orthanc containers and docker automatically manages start up, restart if crashed for you.


Binary Logo

James Manners • Director
Suite 3, Level 2, 10 Queens Road, Melbourne, Victoria 3004, Australia

T: 03 9017 5230 M: 0422 973 235 E: W:

Thanks for the feedback. Unfortunately, my iMac is an older Mac:

Model Name: iMac Model Identifier: iMac11,3 Processor Name: Intel Core i7 Processor Speed: 2.93 GHz Number of Processors: 1 Total Number of Cores: 4 L2 Cache (per Core): 256 KB L3 Cache: 8 MB Memory: 32 GB Boot ROM Version: SMC Version (system): 1.59f2

I don’t think it supports the Docker Desktop app because I tried to install and it won’t run on my Mac. I have a LINUX server that I am starting to use UBUNTU on. I mostly want to
use the iMac because I develop there mostly. I want to add a start and stop feature to an Admin Panel that I have through the API. The start stop just communicates with the system
that Orthanc is running on, not with Orthanc through the REST API>

Incompatible CPU detected

We are sorry, but your hardware is incompatible with Docker Desktop.

Docker requires a processor with virtualization capabilities and hypervisor support.

To learn more about this issue see:

There is a way to install docker using the CLI and something like homebrew: e.g.

That is kind of a pain, and not sure it would work anyways since my Mac can’t run anything higher than High Sierra. Might have to consider buying an more recent refurbished iMac if I want to use Docker on the Mac.

This link is helpful:

Sample .plist:

<?xml version="1.0" encoding="UTF-8"?>">
<plist version="1.0">







Is it possible to pass some args to the shell script or otherwise write separate start, stop and restart scripts for Orthanc ?
The example in the initial post seems to work for starting up using the terminal, but to stop Orthanc I have to hit Ctrl-C in the terminal
because it is running in the foreground.

I presume that if I use the launchd it would start up in the background , but I'm not sure how to stop Orthanc when it is started up using a launchd.

The Unix Debian script has this:

 # Prepare a directory to store the Orthanc logs
 mkdir -p $LOGDIR

 # Return
 # 0 if daemon has been started
 # 1 if daemon was already running
 # 2 if daemon could not be started

 start-stop-daemon --start --quiet --pidfile $PIDFILE --chuid $ORTHANC_USER --background --exec $DAEMON --test > /dev/null \
 >> return 1

 start-stop-daemon --start --quiet --make-pidfile --pidfile $PIDFILE --chuid $ORTHANC_USER --background --exec $DAEMON -- $DAEMON_ARGS \
 >> return 2

 # Add code here, if necessary, that waits for the process to be ready
 # to handle requests from services started subsequently which depend
 # on this one. As a last resort, sleep for some time.