Command-line SVN client for Mac
I purchased a new Mac running Mac OS X v10.8.5 (Mountain Lion). I’ve seen it written in various places that SVN is installed on OS X by default, but when I open a terminal and type which svn the program is not found. I’ve also run find / -name svn to check if it’s installed somewhere that hasn’t been added the the PATH variable.
So it seems like svn is not installed. Where can I get an OS X version of the official command-line SVN client?
6 Answers 6
The default SVN version which is installed along with Xcode command line tools is 1.7.x. If you’re fine with this version, than that should be enough. I want to select my SVN version and for that I’m using Homebrew.
To install a specific SVN version, check available versions:
This command will list all available SVN versions.
Here’s how you can install other than the default version (based on this gist)
Now that the older SVN version is installed, we can re-install the latest formula in order to keep our repository clean:
Now you can switch between versions using svn switch command.
Make sure that brew’s executables are first in your environment path. Check in your .bash_profile that path is set as follows:
SVN на Маке
Купив Мак, я озадачился установкой на него софта, который стоял до этого у меня на PC. Перенести удалось почти всё. Для чего-то нашлись маковские версии, для чего-то удалось подобрать замену. Проблемы возникли с Subversion (SVN). На PC я пользовался Visual SVN Server, который не требует практически никакой настройки и работает сразу после установки. На Маке такого удовольствия не оказалось, так что пришлось немного повозиться.
Итак, вот что я сделал:
- Существует несколько сборок SVN для Mac OS X. Я для себя выбрал версию от MacPorts. На то было ряд причин. Версия там предлагается последняя. Помимо SVN через MacPorts доступно множество других полезных Open Source проектов. В том числе, к примеру, MySQL, который мне тоже нужен. Загрузить MacPorts можно вот отсюда.
Загрузив dmg файл, смонтируйте образ, если он не смонтировался автоматически. После чего запустите pkg файл, что внутри. MacPorts установится на ваш компьютер.
После установки желательно проверить обновления. Для этого в терминале следует ввести:
sudo port -v selfupdate
Если новая версия доступна, то произойдет обновление. Если вы загрузили последнюю версию, то этот шаг можно пропустить.
Загружаем SVN. Для этого в терминале вводим:
sudo port install subversion
Это займет некоторое время. По окончании SVN будет установлен. Все необходимые переменные будут добавлены в PATH. Протестировать установку можно набрав
Должно появиться что-то типа:
Теперь нужно перенести ваши репозитории с PC. Для этого я создал папку Repositories в корне системного диска и скопировал туда все репозитории с PC. Если репозиториев у вас до этого не было, то их можно создать командой svnadmin create. К примеру, svnadmin create /Repositories/MyRepo . Подробно описывать процесс создания репозитория я не буду. Посмотреть можно вот тут.
Запустить SVN сервер просто, для этого в терминале нужно ввести
svnserve -d -r /Repositories
Эта команда запускаем демон SVN. После этого можно обращаться к репозиториям по сети. К примеру так:
Теперь переходим к самому интересному. Я с этим возился дольше всего. Проблема в том, что SVN сервер не запускается автоматически при старте компьютера. Поправить это можно с помощью launchd, стандартного способа автозапуска на Маке. Для этого нужно создать файл
/Library/LaunchAgents/org.tigris.subversion.svnserve.plist (имя можно выбрать по своему усмотрению):
Важно указать полный путь к svnserve. В моём случае это /opt/local/bin/svnserve. Без этого работать всё будет криво. Если вам не нужна конфигурация IPv6, то соответствующий dict блок можно удалить.
После чего в терминале вводятся следующие команды для активации конфигурации:
Ну вот и всё. После этого у меня всё заработало. Этот способ автостарта не запускает демон, а использует inetd. Преимущество такого способа в том, что процесс запускается только при обращении к соответствующему порту. Система также удаляет процесс из памяти, когда считает нужным. Что есть хорошо.
Надеюсь, эта небольшая инструкция избавит вас от множества проблем. 🙂
12 Subversion Apps for OS X
Stay on Top of Emerging Technology Trends
Get updates impacting your industry from our GigaOm Research Community
Subversion (also known as SVN) is a popular version control system. Accessing SVN repositories with OS X is easy – and there are numerous options to do so. In this article we’ll cover 12 different applications that let you access and use Subversion in OS X.
Version 1.4 of the command-line SVN client ships with OS X Leopard and is the quickest way to get started (for OS X Tiger, or if you need SVN 1.5 an easy installer can be found here). All you need to do is fire up the Terminal application and type svn with the required parameters. A great resource to learning how to use the command-line client (and all the functionality of Subversion) can be found at Version Control with Subversion — a free online book. From the command line you can do everything required. In fact, some people will swear against doing anything SVN-related without dealing directly with the command line.
However there are reasons most of us love OS X, and a large number of those reasons relate to the great user interface experience. So what tools are there that can expose SVN functionality via a user interface?
Mac-Only SVN Clients
If you have a need to access a subversion repository with OS X, you are likely to already be familiar with XCode, Apple’s (s aapl) development IDE. Like most good IDEs, XCode has built-in support for version control, including SVN (as well as CVS and Perforce). This works well for basic functionality and if the scope of your needs falls within OS X and/or iPhone development, this will do the job.
svnX is an open source SVN client that uses the SVN command-line client to do the actual work and for a long time it was the best fully-featured native OS X client. The UI, however, is not what we have all come to expect from a great OS X application and it hurts the user experience. Nonetheless, for a free UI solution, one can’t complain.
Versions is a relatively recent commercial subversion client, made specifically for OS X, and looks like it belongs. It costs €39 ($50), but that’s a reasonable price to pay for such functionality with polish. A 21-day trial can be downloaded for free. Along with Cornerstone described below, it is the cream of the OS X Subversion clients.
Like Versions, Cornerstone is a commercial subversion client made specially for OS X that leverages its UI. At $69 (a free 14-day trial can be downloaded) it has feature parity with Versions and can also be considered a premium solution for accessing Subversion on OS X.
SCPlugin is an open-source client that integrates with Finder and enables you to work with your source without loading a separate application. Using icon overlays, it enables you to see at a glance the state of your files, letting you perform SVN actions via the standard Finder popup menu. This was inspired by TortoiseSVN, a popular Windows SVN tool that integrates with Explorer.
SCPlugin is still in development and while it’s mostly functional, there are still issues with reliably badging the icons (you also need to turn off Finder’s Icon Preview feature). Nonetheless, the crucial SVN functionality (checkout, update, commit) work well. When its issues get ironed out this will be a killer solution.
Of note, this can be installed and used along with another option (ie. Versions or Cornerstone) and will simply reflect the SVN status of a local working directory by reading SVN’s hidden control files.
iSVN is currently still in development and available for free (license for the final release is still to be determined by the author), however it is quite functional in its pre-release form and requires the command-line SVN client.
These are a collection of Apple Scripts that enable you to work with SVN directly from within Finder via Finder Scripts. Unlike SCPlugin, these are less intrusive and do not modify the look of Finder in any way. They offer a good middle ground for power users who are used to using SVN on the command line and want a quicker way to perform actions. They also allow for productive use with QuickSilver. It requires the standard SVN command-line client.
Cross Platform SVN Clients
In addition to the above native OS X applications, there are numerous cross-platform clients that will run on OS X. While the big disadvantage to these is the lack of an OS X-friendly user interface, if you need to access Subversion across different platforms, and would like to use the same client everywhere, these will give you a standard and consistence interface. The following clients ran without issue on my OS X 10.5.6 system.
RapidSVN is an open-source client for Windows, Linux, OS X and other *nixes. It’s simple and functional but requires third-party tools for functionality such as visual Diffs. Its written in C++ and executes native code, so it’s the fastest cross-platform client.
SmartSVN is a powerful Java-based client that is offered in a basic open-source variety and an advanced commercial variety ($79). While it is Java-based, there are specific versions for Windows, OS X and Linux, each supporting their native environments (the OS X version will add custom popup menus into Finder as an example).
SyncroSVN is another fully featured, commercial Java-based client available for windows, OS X and Linux, tailored to each platform. It retails for $99 and a free 30-day trial is available. This suffers more than the other cross-platform clients with regards to the user interface (I have never seen MDI child windows with OS X style window management buttons in any other application before).
JSVN is a very no-frills, open-source option and is quite functional. It is by far the fastest Java-based client.
Subclipse is an add-on to the cross-platform Eclipse IDE (which is Java-based, but language independent) . This requires you to upgrade the command-line SVN client that comes with Leopard from 1.4 to 1.5, however, and is best suited to those who already use Eclipse regularly.
What do you think?
What’s your favorite Subversion client for OS X? Are there any other clients I don’t know about? Let us know with a comment.