This tutorial is for intermediate users who want to install and useWine on their computer running macOS.You should already know the basics of how to use the command line.If you don't, read this tutorial first.
What is Wine?
Xcode is a Mac application built by Apple, and it cannot be installed with Homebrew. Even if you answered 'yes', you will still need Homebrew and Ruby to install cocoapods, for.
Wine is awesome.No, I'm not talking about the kind you drink,I mean the kind that lets you run Windows apps without theWindows operating system.It's kind of Zen, when you think about it.Oh, and did I mention it's completely free, legal, and open source?
- Command Line Tools for Xcode (type xcode-select -install into your terminal and press return) A Bourne-compatible shell for installation (i.e., bash or zsh) You can check if you have a bash or zsh shell by opening the terminal and looking at the top of the terminal window And, finally, you need an internet connection.
- Homebrew is an open-source package manager for macOS that offers an easy way to install software and tolls through the command line. If you are a coder, developer, Terminal lover, or more tech-savvy than an average Mac user, you can use Homebrew to simplify software installation on your Mac.
- Xcode Supported Xcode versions. Homebrew supports and recommends the latest Xcode and/or Command Line Tools available for your platform (see OS::Mac:.
- Xcode可以从AppStore里下载安装,Command Line Tools for Xcode需要在终端中输入以下代码运行安装: xcode-select -install 安装Homebrew。.
Nowadays, Windows and Mac play nicely together.You can install Windows and Mac side by side and switch between them usingBoot Camp, but that requiresa reboot every time, and you can only use one operating system at a time.You can also use a tool likeParallels Desktop orVMware Fusionto virtualize Windows and run it together with Mac,but virtualization is slow and it takes up a lot of memory.(Your physical computer creates an imaginary 'virtual' computer within itself,and runs Windows on that. That takes a lot of resources!)On top of that, all of these solutions require you to own a legal copyof Windows, which isn't cheap!
Wine is different. When any program runs, it requests resourceslike memory and disk space from the operating system.All that Wine does is make sure that those requests get answered so thatthe program can run correctly. As far as the program knows, everythingis going smoothly because it has everything it needs.It never even realizes that it's not running on Windows!It's simpler than emulating a whole new computer, so it's faster.Since it's just translating requests, you don't need a copy ofthe actual Windows operating system. Plus, Wine is open source,which means people are continually improving it and adding new features.And you can't beat the price!
Will My Program Work With Wine?
A lot of people discover Wine because they have one specific Windows programthat they need to use, and it's the last thing preventing them from switchingto a different operating system. So, the big question is, will it work?The short answer is: probably, but it's worth checking.
The Wine project maintains a database called theAppDB that hasuser reviews of how well specific Windows programs work under Wine.Search for your program and find out! (If it's not listed, that doesn'tnecessarily mean that it won't work — only that you're apparently tryingto use a very obscure program!)
Requirements
To install Wine on your Mac, you will need the following:
- macOS 10.10 (Yosemite) or above (but 10.15 Catalina is not recommended)
- Access to an Admin account, with password
- An internet connection
To check what version of macOS you're running,click on the Apple logo on the far left side of the toolbar,select 'About This Mac', and look at your versionnumber under the big 'macOS' or 'OS X'. If it's 10.10 or higher, you're all set.
Note that Wine does not work well with macOS 10.15 Catalina. Apple removed 32-bit supportin Catalina, which is a critical part of the macOS system that almost all of Wine relies on.You can run 64-bit applications through Wine on Catalina, but very few applications for Windowsare 64-bit. If you need to use Wine, you should not upgrade to Catalina.
You need an Admin account on your Mac because only Admins can install software.You will need to be logged in to this Admin account during the installation.If there is only one account on your computer, it is an Admin account.The account must have a password: if the account has no password,the sudo
utility will fail. To set or change your password,go to the Accounts section in System Preferences.
Part 1: Install Homebrew
Homebrew is a package manager that makes installingopen source programs much easier. In particular, trying to installa large program like Wine without the help of a package manager would betremendously difficult.Fortunately, Homebrew itself is simple to install: just open up theTerminal and run this command:
The Terminal will tell you what it's about to do, and ask youif you want to proceed: press Enter to do so.The Terminal may then ask for a password: this is the passwordto the Admin account on your computer. As a security measure,the Terminal does not display anything as you type, not evenasterisks (*). Type your password anyway, and press Enter. If you get somekind of error, it might be because the Admin account doesn't have apassword set. Setting a password is required.
Installing Homebrew should only take a few seconds or minutes(depending on the speed of your internet connection). When it's done,the Terminal will say that the installation was successful, and ask you torun brew doctor. Do as it suggests:
This will make Homebrew inspect your system and make sure that everythingis set up correctly. If the Terminal informs you of any issues, you'll needto fix them yourself, and then run brew doctor again to verify that youfixed them correctly. When everything is set up correctly, you'll see themessage Your system is ready to brew
, and you can move on to the next partof the tutorial.
Note: If Homebrew tells you that you need to agree to the Xcode license,you can do that by running:
The Terminal window will fill up with the Xcode license:read it, type agree and hit enter to agree to the license.
Part 2: Install Wine Using Homebrew
Now we get to actually install Wine! We'll let Homebrew do all the work,all you have to do is tell it what you want with this command:
Let's break down this command into parts. brew
refers to Homebrew, whichyou just installed. cask
refers toHomebrew Cask,an extension to Homebrew that is used to install GUI application on yourcomputer. (GUI stands for 'Graphical User Interface'. A GUI application isan app that you can see running, as opposed to invisibly runningin the background.) install
refers to the fact that you're askingHomebrew Cask to install something on your computer, and wine-stable
is the name of the thing that you want it to install. Wine has a 'stable' versionand a 'devel' version: you probably want stable, since it should have fewer bugs.
When you run this command, Homebrew will start automatically downloadingand installing software onto your computer. It might start by installingsoftware that has a totally different name: that's fine! Like most complexapplications, Wine doesn't work alone -- it relies on several other pieces of software torun correctly. These are called 'dependencies', and Homebrew is smart enoughto install them for you automatically when necessary.
While it's working, Homebrew will display messages and progress bars on the Terminal to let you know what it's doing. When it's done installing Wine, it will stop displaying messages and wait for you to type in a new command. When that happens, move on to the next step!
Part 3: Install Windows Programs Using Wine
To install a Windows program, first download the installer file:it should end with .exe. Remember the location you put it, and open upthe Terminal again. cd
to the location, and use ls
to make sure you cansee the installer file. (Note: if you do not know what cd
and ls
are,you should learn how to use the command linebefore using Wine.)
Once you are in the correct directory, run the installer through Wineby running the following command in the Terminal:
Where $INSTALLER
is the name of the installer file. For example,if the installer file is named setup.exe
, you would run:
A window will pop up with a regular graphical Windows installer.Click through it, and you're done!
Part 4: Run Windows Programs Using Wine
Open up the Terminal and run this to get to your Program Files folder:
Run ls to see what programs you have installed. Pick a program,and enter its directory using cd. (If the folder has a space in it,you must type a before the space. For example, Program Files
.If you're having problems, try using tab autocomplete.)There should be a file that ends in .exe
: this is the program file.Type this into Terminal:
Where $PROGRAM
is the name of the .exe
file. For example, if the programfile is named STARCRAFT.EXE
, you would run:
The program will pop up in a new window, ready to use!Enjoy using Windows on your Mac, freely and legally!
Making a Dock Icon
Many people want to be able to run Windows programs the same waythey run other programs on the Mac: by clicking an icon in the Dock.Wine isn't specifically designed to support this, but with a little trickery,we can make it do what we want.
Note: Wine prints out error messages in the Terminal when something goes wrong.By launching Windows programs via a Dock icon, you are sidestepping theTerminal, which means that if something does go wrong and Wine has to quit,it will not be able to tell you what the problem was. The first stepto solving a problem is knowing what it is, so without running Winefrom the Terminal, you won't be able to fix it, and neither will anyone else.Running from the Dock is fine as long as your program seems to be workingcorrectly, but if it crashes, the first thing you should try is running itfrom the Terminal instead: it won't prevent the program from crashing,but it will give you some clues on how to fix the problem.
In order to launch a Windows program via the Dock, we're going towrite an AppleScriptthat launches the program for us, and then putthat AppleScript in the Dock. Essentially, we're writing a program ourselves!Don't worry, it's easy enough. There is a program on your computerthat is designed for helping you write AppleScripts:it's called 'Script Editor', and you can find it in the/Applications/Utilities
directory of your computer,same as the Terminal itself.
Open up the Script Editor. You should see a window with a large areayou can type in near the top: this is where you write your AppleScript.In that area, type the following text:
You'll need to replace $PATH_TO_PROGRAM
with the path from theProgram Files directory to your program executable. You can see thatyou're simply telling the AppleScript to run a line of code in the Terminal:the same line of code that you could run to start your Windows program.
Next, press the Compile button at the top of the window.The text should become colored to indicate that Script Editorunderstands what you wrote. You can also try pressing the Run buttonto run your script: it should open the Windows program successfully.
Lastly, save your script. You can give it whatever name you'd like,but be sure to select File Format: Application in the save options,and leave Startup Screen unchecked.
Open up the Finder, go to where you saved your script, and drag thatfile to your Dock. It should stay there, just like a real application — because it is a real application! However, all it does is runthat launcher command for you, so you can move the application around,rename it, or even delete it, and it won't affect the Windows programthat you're running.
Brew Xcode N/a
Keeping Wine Up to Date
Wine is an open source program. That means that programmersaround the world are continually improving it, adding new featuresand squashing bugs. If you don't update Wine, though, it will neverget those improvements, so it's generally a good idea to check for updatesevery so often. We can use Homebrew to keep Wine up to date: it's easy!Just run this command:
With this command, Homebrew will first update itself, if any updatesare available. It will then find all the outdated software it knows about(including Wine) and upgrade them all to the latest version.Checking for updates isn't strictly necessary, as Wine runs quite wellcurrently. However, it's a good idea to run this command every few monthsor so.
Uninstalling Wine and Homebrew
If you try Wine and you don't like it, uninstalling it is easy.Just run this command:
And Homebrew will helpfully remove Wine from your computer.However, in order to install Wine, Homebrew also had to install many othersmall programs that Wine relies upon to work correctly.(That's why the install process takes so long!)If you want to remove these as well,run this script:
That script will remove everthing that you installed in this tutorial,including Homebrew, Wine, and all the other programs Homebrew installedto get Wine to work correctly.
Please enable JavaScript to view the comments powered by Disqus.How to install brew packages based on XCode, Ruby, Homebrew
- Install Homebrew
- Formulas
This tutorial provides a deep dive of Homebrew,a package manager for Mac OSX (MacOS)that’s like other package mangers for Linux:
Distribution | Package Manager | Format | GUI tools |
---|---|---|---|
Darwin (macOS) | Homebrew | - | brew |
Debian, Ubuntu | dpkg | .deb | APT (Advanced Packaging Tool) |
RedHat, Fedora, openSUSE | RPM | .rpm | Yum, apt4rpm, up2date, urpmi, ZYpp, poldek |
Slackware | tgz | - | - |
Arch Linux, Frugalware, DeLi Linux | Pacman | - | - |
Puppy Linux | PETget | - | - |
Windows | Chocolatey | - | choco |
Step-by-step instructions are provided here to install Homebrew itselfand then install Homebrew packages based on the name of formulae specified for installationin a command such as:
brew install wget
DEFINITION: A formula provides instructions on how to install packages andtheir dependencies, such as where to find tar.gzip files for download.
Brew installs packages in its own Cellar directory (folder)and adds symlinks to the /usr/local folder.
Homebrew is the newest and most popular package utility on OSX.
Brew Install Xcode
Homebrew’s web page is at http://brew.sh
Alternatives to Homebrew
Preparations: XCode CLI
Make a full backup of your system right before following these instructions.
Open the App Store to install XCode, Apple’s IDE for developing Swift and Objective-C to run on iPhones and iPads.
PROTIP: Apple’s App Store only installs .app files. So programs invoked from the command line Terminal (such as gcc) need to be installed a different way.
To verify XCode CLI install:
This message means that it’s not installed:
Open a Terminal to install XCode CLI:
If XCode is not already installed, you are prompted to install it:
Installation is to folder: /Library/Developer/CommandLineTools/.
Homebrew requires OS X 10.5+ and the Xcode command line tools.
To download the Command Line Utilities, go to https://developer.apple.com/download/more/and look for your version of “Command Line Tools (macOS 10.14) for XCode 10”, one that doesn’t say “beta”.
Since the El Capitan version of Mac OSX, file permissions in /usr/local have changed,causing error messages such as:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
So in a Terminal shell window at any folder:
sudo chown -R :staff /usr/local
Verify installation by getting the version of the GNU Compiler Collection:
gcc --version
You should see something like this (for Mojave):
Install Homebrew
Homebrew makes use of Ruby, which comes with macOS.
Install Homebrew if you haven’t already.
CAUTION: Don’t press Enter on the Terminal until the Download Software dialog reaches 100%.
Press the Enter key to the message:
Press RETURN to continue or any other key to abort. thenTo proceed, enter the root password, or type Ctrl+C to abort.
NOTE: The download is from
https://github.com/Homebrew/homebrew/HISTORICAL NOTE: Previously, the Homebrew installer was at
https://raw.github.com/Homebrew/homebrew/go/install/Identify where the Homebrew program itself is located:
The response is the brew executable program at:
The “brew” above is a shell script file.
PROTIP: The “/usr/local” is the default specified by the $HOMEBREW_PREFIX enviornment variable.
Identify where the Homebrew program stores packages:
The response:
Update Homebrew itself
Get Homebrew version:
The response (at time of writing):
NOTE: Homebrew is open-sourced at
https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Common-Issues.mdTo update Homebrew itself and its formulas:
brew update
brew updateYes, run it twice to make sure all dependencies took.
Each run can take several minutes.
Formulas
Popular formulas
wget
iterm2
htop
geoip
nmap
Search for a formula to install
Use an internet browser (such as Google Chrome)to view formula defined in
http://braumeister.org provides recent activity.
Install formula
Install the wget command-line utility by formula name (for example, wget):
brew install wget
This installs to folder /usr/local/bin/wget.
See Tips & Tricks on how to use proxy, remove the beer mug emoji, highlighting within editors, etc.
How many?
Get a count of kegs, how many files, and the disk space they take:
A sample response:
Where did it go?
List where .tar.gz “bottle” files are downloaded into from the internet:
DEFINITION: A “Bottle” is a pre-built binary Keg used for installation instead of building from source.It can be unpacked.
The response includes your user name, which enablesHomebrew to work without using sudo (elevation to root).
The equivalent of the above is:
List bottles downloaded:
Examples of responses:
List brew formulas installed:
ls /usr/local/Cellar
brew list
brew lsThe alternative commands above all do the same thing of the same folder,for example:
There is no response if no brew package has been installed.
See one level below one of the above folders for a specific formula,such as openssl:
It is usually a version number, such as:
DEFINITION: A “Keg” is the installation prefix of a formula, such as:
Packages
List brew package .rb (Ruby language) files installed:
The response is a long list.
List brew package folders:
brew search
The response is a long list.
Troubleshoot Homebrew
Different ways to install weget.
The above is one of several ways to install the wget command-line utility.
One way is to install Apple’s Xcode.
Test wget operating:
cd ~/Downloads
wget http://ftp.gnu.org/gnu/wget/wget-1.15.tar.gzVerify brew installation:
brew doctor
If you see this message at the top of messages returned:
The above may occur if curl and nodejs were installed without using homebrew.
Remove them before installing node and curl using Homebrew:
Create symlinks to installations performed manually in Cellar. This allows you to have the flexibility to install things on your own but still have those participate as dependencies in homebrew formulas.
First, see what exactly will be overwritten, without actually doing it:
The response is:
“Keg-only” refers to a formula installed only into the Cellar and not linked into /usr/local, which means most tools will not find it. This is to avoid conflicting with the system version of the same package.
Alternately, if aswcli is specified for dry-run, the response is:
brew link
NOTE: Homebrew installs to the Cellar it then symlinks some of the installation into /usr/local so that other programs can see what’s going on.
A symlink to the active version of a Keg is called an “opt prefix”.
List where a link goes:
ls -l $(which wget)
Prune symlinks
If you see this message:
A sample response:
List formula (package definitions):
brew edit $FORMULA
The above command brings you to your default text editor (vim or whatever is specified in the $EDITOR variable).
Type :q to quit out.
Upgrade brew formulas
List brew packages that are obsolete:
brew outdated
To stop a specific package from being updated/upgraded,pin it:
brew pin $FORMULA
$FORMULA is ???
To allow that formulae to update again, unpin it.
Download and update ALL software packages installed:
brew upgrade
To see which files would be removed as no longer needed:
brew cleanup -n
No response if there is nothing to clean. Otherwise, example:
To really remove all files no longer needed:
brew cleanup
A sample response:
Remove/Uninstalll
PROTIP: Before deleting, identify its dependencies. For example:
Two delete commands does the same: Additional flags: `–force` or `-f` forcibly removes all versions of that package. `–ignore-dependencies` ignore dependencies for the formula when uninstalling the designated package, which may cause other brews to no longer work correctly.## Tap #Brew tap adds repos not in the Homebrew master repofrom inside a larger package.https://github.com/Homebrew/brew/blob/master/docs/brew-tap.mdsays tap adds to the list of formulae that brew tracks, updates, and installs from.0. List brew tap packages already installed: 0. Install the ip tool included with iproute2 on Linux: The command specififies the account and repo in GitHub, as inhttps://github.com/brona/iproute2mac or https://superuser.com/questions/687310/ip-command-in-mac-os-x-terminal 0. Try it (instead of ifconfig): 0. Remove a tap: ## Brew Cask Install #Homebrew cask extends homebrew and brings its elegance, simplicity, and speed to MacOS (OS X) GUI applications and large binaries.https://caskroom.github.ioWith Cask, you can skip the long URLs, the 'To install, drag this icon…', and manually deleting installer files.0. Temporarily set the permissions on /usr/local: 0. Install brew cask: Applications are kept in their Caskroom under /opt and symblinked to $HOME/Applications from https://github.com/caskroom/homebrew-cask0. https://caskroom.github.io, the home page, said there are 3,197 casks as of June 5, 2016. QUESTION: Is there a graph of growth in cask counts over time?0. Install the cask extension to Homebrew: Alternately: 0. Search for a cask by name, in website is where casks are obtained: https://github.com/caskroom/homebrew-cask/search?utf8=✓ Alternately, run a search command. This example searches for 'yo': PROTIP: One should see the cask definition before using it. I would be suspicious of casks with sparse information. The safe way to get the homepage URL of the programmer is from here (don't Google it and end up at a rogue site).0. Look at some cask definitions: https://github.com/caskroom/homebrew-cask/blob/master/Casks/google-chrome.rb is a sample cask definition:0. Install the cask: brew cask install google-chrome Cask downloads then moves the app to the ~/Applications folder, so it can be opened this way:0. Open the installed cask from Terminal: 0. Installing with cask enables you to cleanup: ### Error prevention If you get an error about 'permissions denied':0. Create a Caskroom folder 0. Edit the .bash_profile 0. Add this line: QUESTION: The use of --caskroom is deprecated?0. Save the file.0. Restart the terminal. ## GUI for Homebrew packageshttps://www.cakebrew.com/ is a GUI to help manage Homebrew packages: ## Analytics offHomebrew now defaults to retrieving behavioral analytics tracking. Although anonymized, you may not want to participate in that. To disable the extra network traffic: ## Debian apt-getDownload Fink commander Fink Installer.pkg from
http://finkcommander.sourceforge.net/help/install.phpThis explains: Fink stores data in the directory “/sw” by default. This goes against the Filesystem Hierarchy Standard’s recommendation to use “/usr/local”. Within Fink’s directory, a FHS-like layout (/sw/bin, /sw/include, /sw/lib, etc.) is used.## Documentation #0. For more documentation on brew, look here and: man brew ## Social media #Social media from brew's readme: * @MacHomebrew on Twitter * IRC freenode.net#machomebrew * Email homebrew-discuss@googlegroups.com * Read archive of emails at https://groups.google.com/forum/#!forum/homebrew-discuss## More on OSXThis is one of a series on Mac OSX:* [MacOS Hardware and accessories](/apple-macbook-hardware/)* [MacOS Boot-up](/macos-bootup/)* [MacOS Versions](/apple-mac-osx-versions/)* [MacOS Terminal Tips and Tricks](/mac-osx-terminal/)* [MacOS Find (files and text in files)](/find/)* [MacOS Keyboard tricks](/apple-mac-osx-keyboard/)* [Text editors and IDEs on MacOS](/text-editors/)* [Command-line utilities for MacOS](/mac-utilities/)* [MacOS Setup automation](/ansible-mac-osx-setup/)* [MacOS Homebrew installers](/macos-homebrew/)* [Task Runners Grunt and Gulp](/task-runners/)* [Printing from macOS or Linux](/printing/)* [Manage Disk Space on MacOS](/mac-diskspace/)* [Data Backups on MacOS](/apple-mac-osx-backup/)* [Screen capture on MacOS](/screen-capture-apple-mac-osx/)* [Ports open](/ports-open/)* [Applications on MacOS](/apple-mac-osx-apps/)* [1password on MacOS](/1password/)* [MacOS iPhone integration](/mac-iphone/)* [Windows on Apple MacOS](/windows-on-apple-mac-osx/)* [Packer create Vagrant Windows image](/packer/)* [Remote into Windows](/rdp/)* [Python on MacOS](/python-install/)* [Maven on MacOS](/maven-on-macos/)* [Ruby on MacOS](/ruby-on-apple-mac-osx/)* [Java on MacOS](/java-on-apple-mac-osx/)* [Node on MacOS installation](/node-osx-install/)* [PHP on MacOS](/php-on-apple-mac-osx/)* [Scala ecosystem](/scala-ecosystem/)Please enable JavaScript to view the comments powered by Disqus.