Skip to content

Instantly share code, notes, and snippets.

@adejones
Created February 21, 2017 15:45
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 adejones/11c96c435980ab9c588093ba3ba0fdab to your computer and use it in GitHub Desktop.
Save adejones/11c96c435980ab9c588093ba3ba0fdab to your computer and use it in GitHub Desktop.
Script for Wine app using XQuartz. Open up Apple's Script Editor * Edit the program per the directions in the lines that start with -- * if everything is default, you only need to edit the "set toRun" line * After you have edited it for your program, save it as an "Application" (not a script) in the script editor * this will create a .app for yo…
on run
--edit this to be the correct location and file to run (typically only edit after the "drive_c")
set toRun to "$WINEPREFIX/drive_c/Program Files/MyProgram/MyProgramName.exe"
--edit winePrefix if you are not using the default prefix
set winePrefix to "$HOME/.wine"
--edit wineLocation if your wine install is not the default location
set wineLocation to "/usr/local/bin"
--edit dyldFallbackLibraryPath to your X11 lib folder, this one is set for XQuartz on 10.6+
—set dyldFallbackLibraryPath to "/opt/X11/lib"
-------------------------------------------------------
--DO NOT EDIT ANYTHING BELOW THIS LINE
-------------------------------------------------------
set toRunPath to do shell script "WINEPREFIX=\"" & winePrefix & "\"; TEMPVAR=\"" & toRun & "\"; echo \"${TEMPVAR%/*}\""
set toRunFile to do shell script "WINEPREFIX=\"" & winePrefix & "\"; TEMPVAR=\"" & toRun & "\"; TEMPVAR2=\"" & toRunPath & "\"; echo \"${TEMPVAR#$TEMPVAR2/}\""
do shell script "PATH=\"" & wineLocation & ":$PATH\"; export WINEPREFIX=\"" & winePrefix & "\"; export DYLD_FALLBACK_LIBRARY_PATH=\"" & dyldFallbackLibraryPath & "\"; cd \"" & toRunPath & "\"; wine \"" & toRunFile & "\" > /dev/null 2>&1 &"
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment