Skip to content

Instantly share code, notes, and snippets.

@maxpietsch
Created June 25, 2019 08:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxpietsch/5cbb5c2061af2546f8b4ba2022947db5 to your computer and use it in GitHub Desktop.
Save maxpietsch/5cbb5c2061af2546f8b4ba2022947db5 to your computer and use it in GitHub Desktop.
macos mrview as applicatio
#!/usr/bin/env bash
APP=mrview
mkdir -vp ${APP}.app/Contents/MacOS ${APP}.app/Contents/Resources
PATH="$PATH:/usr/libexec" # PlistBuddy in PATH
printf '#!/usr/bin/osascript\ntell application "Terminal"\n\tactivate\n\tdo script "mrview; exit"\nend tell\n' > ${APP}.app/Contents/MacOS/${APP}
chmod +x ${APP}.app/Contents/MacOS/${APP}
PlistBuddy ${APP}.app/Contents/Info.plist -c "add CFBundleDisplayName string ${APP}"
PlistBuddy ${APP}.app/Contents/version.plist -c "add ProjectName string ${APP}"
@maxpietsch
Copy link
Author

maxpietsch commented Jun 25, 2019

the above creates an mrview.app application in the local folder

@maxpietsch
Copy link
Author

maxpietsch commented Jun 25, 2019

second attempt (without starting a terminal):
https://drive.google.com/file/d/1-vQH4TZWiJ7Eb-euqYO_CUhkLgcCVBrO/view?usp=sharing
Adjust the path to mrview in /Applications/mrview.app/Contents/document.wflow if it is not /usr/local/bin/mrview

Associate .mif and .nii files with the mrview app (this does not seem to work for ".mif.gz" and ".nii.gz" though):

brew install duti # or compile https://github.com/moretension/duti
duti -s $(osascript -e 'id of app "mrview"') .nii all
duti -s $(osascript -e 'id of app "mrview"') .mif all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment