# Running slicer from mac terminal

**URL:** <https://discourse.slicer.org/t/running-slicer-from-mac-terminal/18908>\
**Category:** Support\
**Tags:** python, macos\
**Created:** [July 24, 2021, 7:32pm UTC](https://discourse.slicer.org/t/running-slicer-from-mac-terminal/18908 "2021-07-24T19:32:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Panda](https://avatars.discourse-cdn.com/v4/letter/p/71c47a/32.png) [@Panda](https://discourse.slicer.org/u/Panda)\
**Post date:** [July 24, 2021, 7:32pm UTC](https://discourse.slicer.org/t/running-slicer-from-mac-terminal/18908/1 "2021-07-24T19:32:02Z")

</div>

Hello,

There are two issues I am facing - not really clear what’s happening. Quite basic actually:

1. How do you initiate Slicer from mac terminal and run a python script without GUI -the documentation has stuff for Windows
2. And more importantly, how to run a python script within slicer (using the python inspector)? I am encountering modulenotfound error all the time

Any help would be cool.

Thanks

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [July 25, 2021, 7:35pm UTC](https://discourse.slicer.org/t/running-slicer-from-mac-terminal/18908/2 "2021-07-25T19:35:07Z")

</div>

You can do something like the following:

`/Applications/Slicer.app/Contents/MacOS/Slicer --no-splash --no-main-window --python-code "print('hello slicer'); exit()"`

Maybe you can suggest edits to any documentation that’s not clear or is too windows-specific? (e.g. issue a pull request through github with change suggestions).

---

<div class="post-metadata">

**Author:** ![Panda](https://avatars.discourse-cdn.com/v4/letter/p/71c47a/32.png) [@Panda](https://discourse.slicer.org/u/Panda)\
**Post date:** [July 27, 2021, 6:06am UTC](https://discourse.slicer.org/t/running-slicer-from-mac-terminal/18908/3 "2021-07-27T06:06:15Z")

</div>

@pieper Thank you for the reply 🙂 Yes, I finally figured it out - let me just wrap up with the whole thing - then i will post my solution - with some more details - might help future Mac 3d slicer users - not sure if what I did is the best way to do it, but that’s what I could manage and get things to work 😛

---

<div class="post-metadata">

**Author:** ![koeglfryderyk](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/koeglfryderyk/32/14638_2.png) [@koeglfryderyk](https://discourse.slicer.org/u/koeglfryderyk)\
**Post date:** [February 23, 2022, 7:26pm UTC](https://discourse.slicer.org/t/running-slicer-from-mac-terminal/18908/4 "2022-02-23T19:26:41Z")

</div>

I didn’t see those instructions added to the docs so I created a [pull request](https://github.com/Slicer/Slicer/pull/6217) with updated instructions in the script repository.

@pieper could you take a look at it?

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [February 23, 2022, 7:41pm UTC](https://discourse.slicer.org/t/running-slicer-from-mac-terminal/18908/5 "2022-02-23T19:41:37Z")

</div>

Thanks @koeglfryderyk, request is merged.
