Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I'm writing cross-platform scripts that are executing utilities and some of them are windows executables.

I would like to find a solution that would not require me to prepend the command line with wine when I run from OS X.

I know that on Windows it is possible to define executable files based on file extension but I would like to know if this is possible to do on OS X and how.

I am open to suggestions ;)

share|improve this question
add comment

4 Answers

up vote 3 down vote accepted

How about setting all .exe files to "open with" wine?

share|improve this answer
    
I know how open works and I am ready to bet that this will not solve the problem of calling the exe from the shell, abd this was my intend. –  sorin Apr 7 '11 at 6:59
2  
Ok then. Set them to "open with" your own bash shell. Your own bash shell looks something like... #!/bin/bash path_to_wine=/some/path/here ./path_to_wine $1 exit 0 Make sure to chmod +x your shell script. –  Harv Apr 7 '11 at 7:54
    
Where 'your own bash shell' = 'your own bash script'. –  Harv Apr 8 '11 at 3:03
add comment

Right-click (or Ctrl+click) on any .exe file and select Get Info from the menu (or just select the file and hit Cmd+I). Go the the Open With section in the info panel and choose Wine (depending on your setup, it may already be in the dropdown list, or you may have to select Other and find it yourself). Then click on Change All to set all .exe files to open with the same app.

share|improve this answer
add comment

I don't think there is any sort of setting you can change that'll solve this problem exactly. One thing you could try: on the Mac, rename the windows utility, and write a shell script (made executable with chmod +x) that runs that utility with wine.

share|improve this answer
add comment

have you tried "chown -x" on the files, that should set it to executable. Works with Ruby & Python scripts, should in theory work with exe.

share|improve this answer
2  
First of all, don't you mean chmod +x? And even with that, I don't think it'll work, since the shell/OS wouldn't know how to execute it. For the scripts, I believe they use the shebang of the file. –  Loïc Wolff Apr 6 '11 at 11:26
    
Yes, I meant +, and not - –  baldy Apr 8 '11 at 8:04
    
and it's not chown (changing the owner), it's chmod. –  Loïc Wolff Apr 8 '11 at 8:23
    
Thanks for the wake-up call, I'm also fairly new to this, coming from a 18 year Windows background, trying to see the world beyond. –  baldy Apr 8 '11 at 8:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.