Slicer installation on Mac using homebrew

It works fine for me using brew:

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

Note: once the PR is accepted, the line will just be:

brew cask install slicer-nightly
1 Like

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.

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

It’d be nice to get some feedback :slightly_smiling_face:

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.

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

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).

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.

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

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 by the Kitware machines. I think @jcfr can confirm this.

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

Andras, according to @pieper, they’ll be tracked as usual because the packages are still downloaded from midas.

1 Like

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

It will be complementary.

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

Indeed, in that particular case, see

:+1:

1 Like

I like the idea of linuxbrew! Unfortunately there doesn’t seem to be a windowsbrew but of course there are some alternatives.

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

1 Like

I completely agree with you.

1 Like

For completeness, this discussion could be considered a follow up on Add Slicer Nightly to Homebrew (macOS)

1 Like

Looks good, I’ll explore those too.

That would be https://chocolatey.org/

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

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.

Hi all,

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

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

Thanks for the update.

Homebrew and caskrepair have just been installed on factory.kitware. Summary here

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

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 or download.slicer.org). What is the value 676538 ?

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

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:

$ 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



1 Like

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