# Slicer installation on Mac using homebrew

**URL:** <https://discourse.slicer.org/t/slicer-installation-on-mac-using-homebrew/933>\
**Category:** Development\
**Created:** [August 23, 2017, 7:48pm UTC](https://discourse.slicer.org/t/slicer-installation-on-mac-using-homebrew/933 "2017-08-23T19:48:23Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fernando](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fernando/32/5640_2.png) [@Fernando](https://discourse.slicer.org/u/Fernando)\
**Post date:** [August 23, 2017, 7:48pm UTC](https://discourse.slicer.org/t/slicer-installation-on-mac-using-homebrew/933/1 "2017-08-23T19:48:23Z")

</div>

It works fine for me using `brew`:

```auto
brew cask install https://raw.githubusercontent.com/fepegar/homebrew-versions/cask_repair_update-slicer-nightly/Casks/slicer-nightly.rb

```

Note: once the [PR](https://github.com/caskroom/homebrew-versions/pull/4318) is accepted, the line will just be:

```auto
brew cask install slicer-nightly

```

---

<div class="post-metadata">

**Author:** ![fedorov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fedorov/32/14_2.png) [@fedorov](https://discourse.slicer.org/u/fedorov)\
**Post date:** [August 23, 2017, 8:01pm UTC](https://discourse.slicer.org/t/slicer-installation-on-mac-using-homebrew/933/2 "2017-08-23T20:01:05Z")

</div>

This is great progress @Fernando, but I am pretty sure brew approach is still not going to work for 100% of Mac users. It won’t replace the package.

---

<div class="post-metadata">

**Author:** ![Fernando](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fernando/32/5640_2.png) [@Fernando](https://discourse.slicer.org/u/Fernando)\
**Post date:** [August 23, 2017, 8:04pm UTC](https://discourse.slicer.org/t/slicer-installation-on-mac-using-homebrew/933/3 "2017-08-23T20:04:28Z")

</div>

> [@Unable to open Slicer package on Mac](https://discourse.slicer.org/t/unable-to-open-slicer-package-on-mac/932/4):
>
> I am pretty sure brew approach is still not going to work for 100% of Mac users. It won’t replace the package.

Why? What do you mean? What is exactly _the package_? Have you read the Lab about it?  
[https://www.slicer.org/wiki/Documentation/Labs/HomebrewCask](https://www.slicer.org/wiki/Documentation/Labs/HomebrewCask)

It’d be nice to get some feedback 🙂

---

<div class="post-metadata">

**Author:** ![fedorov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fedorov/32/14_2.png) [@fedorov](https://discourse.slicer.org/u/fedorov)\
**Post date:** [August 23, 2017, 8:25pm UTC](https://discourse.slicer.org/t/slicer-installation-on-mac-using-homebrew/933/4 "2017-08-23T20:25:56Z")

</div>

> [@Unable to open Slicer package on Mac](https://discourse.slicer.org/t/unable-to-open-slicer-package-on-mac/932/5):
>
> Why? What do you mean?

Sorry for not being specific. I was just thinking about some of the Slicer users I know who are MDs. I am not sure they would appreciate using terminal and learning about brew and casks. I can’t imagine them running the steps you listed in “Steps to upgrade Slicer app (for users)” on the page lab page you referenced.

> [@Unable to open Slicer package on Mac](https://discourse.slicer.org/t/unable-to-open-slicer-package-on-mac/932/5):
>
> What is exactly the package?

For the users like above, _the package_ is the dmg file that they download from the Slicer web page.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [August 23, 2017, 8:45pm UTC](https://discourse.slicer.org/t/slicer-installation-on-mac-using-homebrew/933/5 "2017-08-23T20:45:00Z")

</div>

I’m not a mac user, but this seems to be a very nice option for developers who use homebrew for installing applications.

Do you know if we can track number of downloads/installations/updates done through homebrew? If not, then we need to implement a more robust mechanism to measure application usage (e.g., check for updates at application startup and count these checks on the server side).

---

<div class="post-metadata">

**Author:** ![fedorov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fedorov/32/14_2.png) [@fedorov](https://discourse.slicer.org/u/fedorov)\
**Post date:** [August 23, 2017, 8:47pm UTC](https://discourse.slicer.org/t/slicer-installation-on-mac-using-homebrew/933/6 "2017-08-23T20:47:04Z")

</div>

> [@Unable to open Slicer package on Mac](https://discourse.slicer.org/t/unable-to-open-slicer-package-on-mac/932/7):
>
> this seems to be a very nice option for developers who use homebrew for installing applications

I completely agree. It is very nice to have this feature, I am glad @Fernando is working on this, and I appreciate it! All I am saying is that it will not replace the downloadable dmg packages for Mac for all of the Slicer users on Mac.

---

<div class="post-metadata">

**Author:** ![Fernando](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fernando/32/5640_2.png) [@Fernando](https://discourse.slicer.org/u/Fernando)\
**Post date:** [August 23, 2017, 8:55pm UTC](https://discourse.slicer.org/t/slicer-installation-on-mac-using-homebrew/933/7 "2017-08-23T20:55:16Z")

</div>

@lassoan, @fedorov, thanks a lot for your opinions!

> [@Unable to open Slicer package on Mac](https://discourse.slicer.org/t/unable-to-open-slicer-package-on-mac/932/8):
>
> All I am saying is that it will not replace the downloadable dmg packages for Mac for all of the Slicer users on Mac.

Andrey, I didn’t propose it as a replacement of the package but as an alternative for the process of installing and upgrading. I think most users (like the MDs) will be doing it the traditional way, but I also think that developers will appreciate this approach. Also, it’s very easy to [maintain](https://www.slicer.org/wiki/Documentation/Labs/HomebrewCask#Update) by the Kitware machines. I think @jcfr can confirm this.

Also, the package _is_ downloaded and automatically mounted, installed and unmounted by `brew`.

> [@Unable to open Slicer package on Mac](https://discourse.slicer.org/t/unable-to-open-slicer-package-on-mac/932/7):
>
> Do you know if we can track number of downloads/installations/updates done through homebrew?

Andras, according to @pieper, [they’ll be tracked as usual](https://discourse.slicer.org/t/add-slicer-nightly-to-homebrew-macos/811/10) because the packages are still [downloaded from midas](https://github.com/caskroom/homebrew-versions/blob/master/Casks/slicer-nightly.rb#L6).

---

<div class="post-metadata">

**Author:** ![Fernando](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fernando/32/5640_2.png) [@Fernando](https://discourse.slicer.org/u/Fernando)\
**Post date:** [August 23, 2017, 8:56pm UTC](https://discourse.slicer.org/t/slicer-installation-on-mac-using-homebrew/933/8 "2017-08-23T20:56:50Z")

</div>

BTW Linux users might also be able to brew Slicer, I can work on it if needed: [http://linuxbrew.sh/](http://linuxbrew.sh/)

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [August 23, 2017, 8:59pm UTC](https://discourse.slicer.org/t/slicer-installation-on-mac-using-homebrew/933/9 "2017-08-23T20:59:17Z")

</div>

> [@Unable to open Slicer package on Mac](https://discourse.slicer.org/t/unable-to-open-slicer-package-on-mac/932/9):
>
> as an alternative for the process of installing and upgrading.

It will be complementary.

Similarly to a potential `sudo apt-get install slicer` and alike …

> [@Unable to open Slicer package on Mac](https://discourse.slicer.org/t/unable-to-open-slicer-package-on-mac/932/9):
>
> they’ll be tracked as usual because the packages are still downloaded from midas.

Indeed, in that particular case, see

> <https://github.com/Homebrew/homebrew-cask-versions/blob/a875838c82cac4f2e3a930444beb7f6397efdf5f/Casks/slicer-nightly.rb#L6>

> [@Unable to open Slicer package on Mac](https://discourse.slicer.org/t/unable-to-open-slicer-package-on-mac/932/9):
>
> Also, it’s very easy to maintain by the Kitware machines. I think @jcfr can confirm this.

👍

---

<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:** [August 23, 2017, 9:16pm UTC](https://discourse.slicer.org/t/slicer-installation-on-mac-using-homebrew/933/10 "2017-08-23T21:16:11Z")

</div>

I like the idea of linuxbrew! Unfortunately there doesn’t seem to be a windowsbrew but of course there are [some alternatives](https://laracasts.com/discuss/channels/laravel/homebrew-install-on-windows-os).

Also I suppose if we wanted to we could make a wrapper application (maybe with Qt or with [electron](https://electron.atom.io/) or similar) that provided a consistent user installation experience across platforms.

---

<div class="post-metadata">

**Author:** ![fedorov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fedorov/32/14_2.png) [@fedorov](https://discourse.slicer.org/u/fedorov)\
**Post date:** [August 23, 2017, 9:16pm UTC](https://discourse.slicer.org/t/slicer-installation-on-mac-using-homebrew/933/11 "2017-08-23T21:16:38Z")

</div>

> [@Unable to open Slicer package on Mac](https://discourse.slicer.org/t/unable-to-open-slicer-package-on-mac/932/9):
>
> Andrey, I didn’t propose it as a replacement of the package but as an alternative for the process of installing and upgrading. I think most users (like the MDs) will be doing it the traditional way, but I also think that developers will appreciate this approach.

I completely agree with you.

---

<div class="post-metadata">

**Author:** ![fedorov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fedorov/32/14_2.png) [@fedorov](https://discourse.slicer.org/u/fedorov)\
**Post date:** [August 23, 2017, 9:42pm UTC](https://discourse.slicer.org/t/slicer-installation-on-mac-using-homebrew/933/12 "2017-08-23T21:42:06Z")

</div>

For completeness, this discussion could be considered a follow up on [Add Slicer Nightly to Homebrew (macOS)](https://discourse.slicer.org/t/add-slicer-nightly-to-homebrew-macos/811)

---

<div class="post-metadata">

**Author:** ![Fernando](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fernando/32/5640_2.png) [@Fernando](https://discourse.slicer.org/u/Fernando)\
**Post date:** [August 23, 2017, 10:12pm UTC](https://discourse.slicer.org/t/slicer-installation-on-mac-using-homebrew/933/13 "2017-08-23T22:12:46Z")

</div>

> [@pieper](#):
>
> I like the idea of linuxbrew! Unfortunately there doesn’t seem to be a windowsbrew but of course there are some alternatives.

Looks good, I’ll explore those too.

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [August 23, 2017, 10:42pm UTC](https://discourse.slicer.org/t/slicer-installation-on-mac-using-homebrew/933/14 "2017-08-23T22:42:01Z")

</div>

> [@Fernando](#):
>
> there doesn’t seem to be a windowsbrew

That would be [https://chocolatey.org/](https://chocolatey.org/)

---

<div class="post-metadata">

**Author:** ![Fernando](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fernando/32/5640_2.png) [@Fernando](https://discourse.slicer.org/u/Fernando)\
**Post date:** [August 24, 2017, 1:06am UTC](https://discourse.slicer.org/t/slicer-installation-on-mac-using-homebrew/933/15 "2017-08-24T01:06:09Z")

</div>

> [@pieper](#):
>
> I like the idea of linuxbrew!

I have been checking. Unfortunately there’s only `brew` and no `brew cask`, so only command-line tools can be installed with Linuxbrew.

> [@jcfr](#):
>
> That would be [https://chocolatey.org/](https://chocolatey.org/)

I have also taken a look at `choco`. I tried creating a package for Slicer, but I finally gave up. It’s way more complicated than `brew`.

---

<div class="post-metadata">

**Author:** ![Fernando](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fernando/32/5640_2.png) [@Fernando](https://discourse.slicer.org/u/Fernando)\
**Post date:** [September 6, 2017, 11:58am UTC](https://discourse.slicer.org/t/slicer-installation-on-mac-using-homebrew/933/16 "2017-09-06T11:58:52Z")

</div>

Hi all,

FYI and to follow up, I’ve kept updating the cask:

> **[Homebrew/homebrew-cask-versions](https://github.com/Homebrew/homebrew-cask-versions/commits/3502f8019d86b0e3284ee0e170eac48c8a49266e/Casks/slicer-nightly.rb)**
>
> 🔢 Alternate versions of Casks. Contribute to Homebrew/homebrew-cask-versions development by creating an account on GitHub.

The Lab in the Slicer wiki is also updated with explanations and instructions:  
[https://www.slicer.org/wiki/Documentation/Labs/HomebrewCask](https://www.slicer.org/wiki/Documentation/Labs/HomebrewCask)

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [September 6, 2017, 12:47pm UTC](https://discourse.slicer.org/t/slicer-installation-on-mac-using-homebrew/933/17 "2017-09-06T12:47:14Z")

</div>

Thanks for the update.

Homebrew and caskrepair have just been installed on `factory.kitware`. Summary [here](https://www.slicer.org/wiki/Documentation/Nightly/Developers/Factory/HomeBrewInstall)

We now need an automated way to generate the following command:

```auto
cask-repair --cask-version 4.7.0.26273,676538 --fail-on-error --blind-submit slicer-nightly

```

While `4.7.0` and `26273` respectively correspond to the major.minor.patch version and the SVN revision (and I should be able to write a small script getting that info from either [slicer.kitware.com](http://slicer.kitware.com) or [download.slicer.org](http://download.slicer.org)). What is the value `676538` ?

---

<div class="post-metadata">

**Author:** ![Fernando](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fernando/32/5640_2.png) [@Fernando](https://discourse.slicer.org/u/Fernando)\
**Post date:** [September 6, 2017, 12:50pm UTC](https://discourse.slicer.org/t/slicer-installation-on-mac-using-homebrew/933/18 "2017-09-06T12:50:05Z")

</div>

Thanks @jcfr. I don’t know what it means, hoped you could answer. It’s the number at the end of the download URL, e.g. [http://download.slicer.org/bitstream/684799](http://download.slicer.org/bitstream/684799)

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [September 6, 2017, 1:24pm UTC](https://discourse.slicer.org/t/slicer-installation-on-mac-using-homebrew/933/19 "2017-09-06T13:24:34Z")

</div>

Great. That was the missing information. It corresponds to the database identifier allowing to retrieve the item.

For example, given the latest nightly, here are two ways to download the package:

- by bitstreamId: `http://slicer.kitware.com/midas3/api/rest?method=midas.bitstream.download&id=684799`
- by checksum: `http://slicer.kitware.com/midas3/api/rest?method=midas.bitstream.download&checksum=5010fdd6d2a960e87280b4e867dd99ad`

All of that said, here is the command that will be executed every morning:

```auto
$ curl --progress-bar "http://download.slicer.org/find?os=macosx&stability=any" -o /tmp/latest && \
version=$(cat /tmp/latest | python -c 'import sys, json; print(json.load(sys.stdin)["version"])') && \
revision=$(cat /tmp/latest | python -c 'import sys, json; print(json.load(sys.stdin)["revision"])') && \
bitstream_id=$(cat /tmp/latest | python -c 'import sys, json; print(json.load(sys.stdin)["download_url"])' | cut -d"/" -f3) && \
echo "cask-repair --cask-version $version.$revision,$bitstream_id --fail-on-error --blind-submit slicer-nightly"

######################################################################## 100.0%
cask-repair --cask-version 4.7.0.26338,684799 --fail-on-error --blind-submit slicer-nightly

```

---

<div class="post-metadata">

**Author:** ![Fernando](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fernando/32/5640_2.png) [@Fernando](https://discourse.slicer.org/u/Fernando)\
**Post date:** [September 6, 2017, 5:40pm UTC](https://discourse.slicer.org/t/slicer-installation-on-mac-using-homebrew/933/20 "2017-09-06T17:40:11Z")

</div>

Great, I’ll stop updating the cask. Will the script be run immediately after binaries are ready to be downloaded?

[Next page](https://discourse.slicer.org/t/slicer-installation-on-mac-using-homebrew/933.md?page=2)
