Disclaimer... I'm not a Unix Guru, by any stretch. In fact, I avoid the terminal and that's why I'm doing this post. Hopefully, I'll help get you started using subversion on your Mac. Here we go.
First, download the software
Download latest version of subversion. Martin Ott of The Coding Monkey has been kind enough to provide a .dmg file for easy install. Here is the direct link to
version 1.4.4. But check to make sure there isn't a more current version at
Martin Ott's site. You'll need version 1.4 to run svnX (the GUI client). After you download double-click and unzip, then double-click the pkg file and walk through the install process.
Subversion is run by entering commands in the terminal. In other words, there is no GUI. You'll need to
download svnX and double click svnX_0_9_13.dmg (or whatever the latest version is). It will unpack and you can drag and drop the svnX application into your Applications folder.
Now here is where I get stuck. I try to launch svnX and get going, but I can't create a repository and start getting error messages, blah, blah ,blah.
So a little hunting I discover I have to use the command-line to create the subversion repository. Let's dig deep for those long lost unix commands. Don't worry. I'll walk you through it.
Go to Applications folder and open the Utilities folder and double-click Terminal application. That will bring up the terminal window.
Go ahead and type in the terminal
svn
and click [enter] on your keyboard. If you're like me you'll the get following
~bash svn: command not found.
Hrummmf! That didn't work.
A little googling turns up that the SVN files are located in /usr/local/bin
So, at the terminal type the following and click [enter]
/usr/local/bin/svn
You should get the message
Type 'svn help' for usage.
If you did, Great you have svn installed and we know where it is and can get started.
If you did not, then type into the terminal
cd /usr/local/bin/
(this will switch you to the directory that should have svn installed). Then type
ls
to get a listing for the directory. If you don't see any svn files, then you either don't have svn installed or it's located in another directory.
Second, create our repository
Type the following into the terminal
/usr/local/bin/svnadmin create [/path/to/your/repository/].
the path to your repository could be just the name of a folder like "myrepository"
If you do that, it will create a repository in whatever folder you are currently in. So, do a
ls
to see if you new repository was created. Yeah! There is it.
Now, type the following to see what's inside your repository.
ls myrepository
Third, setup your project folder and import it
I'm going to setup my project folder in my home folder which is called smaestre
Double click your hard drive
Click on the House icon on the left side (it will have your username next to it)
Create a new folder called Project and open it.
Inside the project folder create three more folders branch, tags, trunk
Copy the files you want to source control into the trunk folder. Any type of file can be source controlled so it could be html, jpgs, photoshop, flash files whatever.
Go back to your Terminal application.
Type (Remember it's case-sensitive)
/usr/local/bin/svn import [path to your project folder] (i.e. /Users/smaestre/project ) file:///Users/smaestre/mynewrepository/ -m "Initial Import
Press [enter] key.
I know it's a BIG command and it's easy to have typos, but don't give up.
Fourth, checkout your repository
Now,double-click your svnX icon to launch.
- Click the "+" sign
- Click the Magnifying Glass to locate "mynewrepository"
- Click on the folder and click open
- Double click your new repository at the top portion of the window to open it.
- Click SVN Checkout
- Click New Folder to create a new working folder.
(This is where a copy of your files will be placed and these are the files you will edit using Eclipse, Dreamweaver, Photoshop, etc.)
- After creating the new folder, click open button.
Now you can edit the files in the Trunk folder. Subversion will track which files you edit and you can commit those changes as you work on them.
Feedback
Hope you found this post helpful and if you have
suggestions for improving it, please comment below.