[Updated] Subversion 1.5/1.6 and Xcode 3+ HOWTO
[Updated] Subversion 1.5/1.6 and Xcode 3+ HOWTO
- Subject: [Updated] Subversion 1.5/1.6 and Xcode 3+ HOWTO
- From: Kyle McKay <email@hidden>
- Date: Thu, 23 Apr 2009 18:59:38 -0700
=====================================
Subversion 1.5/1.6 and Xcode 3+ HOWTO
=====================================
I've been using Subversion 1.5.6 with Xcode 3.1.2 through a
configuration that does not involve replacing the /usr/lib/libsvn_*
library files or the /usr/bin/svn* binaries. I'm sharing my
configuration in case someone else finds it helpful.
------------
INSTALLATION
------------
1. Fetch a Subversion installer for Mac OS X from:
http://downloads.open.collab.net/binaries.html
The most recent installer can be found on that page. If you would
prefer an older installer (1.5.6 for example because you're not ready
to jump on the 1.6.x bandwagon just yet) you can choose from all the
available Mac OS X installers at:
http://svnbinaries.open.collab.net/servlets/ProjectDocumentList?folderID=164
In particular, the Subversion 1.5.6 installer can be found at:
http://svnbinaries.open.collab.net/files/documents/153/1707/file_1707.dat/Subversion 1.5.6 Universal.dmg
NOTE: Subversion 1.6.0 and 1.6.1 are currently NOT RECOMMENDED for use
with Xcode. See Subversion bug report 2580 for details as to why:
http://subversion.tigris.org/issues/show_bug.cgi?id=2580
with more details in this message:
http://lists.apple.com/archives/xcode-users/2009/Mar/msg00443.html
2. Mount the .dmg you just downloaded and install the package. (Most
everything installs into /opt/subversion except for a few symbolic
links that are placed into /usr/local/bin.)
-------------
CONFIGURATION
-------------
3. If you might want to also use Xcode 2.5 with the newly installed
Subversion then do this from a Terminal shell prompt:
# NOTE: The following line has been wrapped
# onto two lines by using the \ line
# continuation character
defaults write com.apple.Xcode \
XCSubversionToolPath /usr/local/bin/svn
IMPORTANT: Steps 4 & 5 below can cause some applications that ship
with their own Subversion libraries to misbehave. It's possible to
set DYLD_LIBRARY_PATH for only the Xcode application to avoid these
problems. See Step 6 below and follow it in place of Steps 4 & 5 if
you need to do this. Also note that Steps 4 & 5 are user-specific
whereas Step 6 affects all users.
4. Configure your environment so Xcode 3+ will find the new libraries.
Do this from a Terminal prompt:
# NOTE: The following line has been wrapped
# onto two lines by using the \ line
# continuation character
defaults write ~/.MacOSX/environment \
DYLD_LIBRARY_PATH /opt/subversion/lib
# Then convert it back into text xml format
plutil -convert xml1 ~/.MacOSX/environment.plist
NOTE: This change will persist across installation/update/removal of
the Xcode application but will be specific to your user account.
5. For #4 to take effect YOU MUST LOG OUT AND LOG BACK IN (you don't
have to restart, just log out) -OR- you MUST do the following (then
quit and restart Xcode) from a Terminal prompt:
launchctl setenv DYLD_LIBRARY_PATH /opt/subversion/lib
6. As an alternative to Steps 4 & 5, you can modify the Xcode
application directly so that it will be the only application affected
by the DYLD_LIBRARY_PATH addition. If you do this, you will have to
reapply this change anytime you install a new Xcode application. The
following assumes that the version of Xcode you wish to modify is
located at /Developer/Applications/Xcode.app -- if it isn't adjust the
instructions accordingly. Do the following from a Terminal prompt:
# NOTE: The following line has been wrapped
# onto three lines by using the \ line
# continuation character
defaults write \
/Developer/Applications/Xcode.app/Contents/Info \
LSEnvironment -dict DYLD_LIBRARY_PATH /opt/subversion/lib
# Then convert it back into text xml format
# NOTE: The following line has been wrapped
# onto two lines by using the \ line
# continuation character
plutil -convert xml1 \
/Developer/Applications/Xcode.app/Contents/Info.plist
# Now force Launch Services to notice the Info.plist change
# This step is REQUIRED for the above changes to take effect,
# logging out/rebooting won't do it.
# NOTE: The following line has been wrapped
# onto three lines by using the \ line
# continuation character
# NOTE: The first two lines MUST be unwrapped
# into one WITHOUT ANY SPACES between them
/System/Library/Frameworks/CoreServices.framework/\
Frameworks/LaunchServices.framework/Support/lsregister \
-v -f /Developer/Applications/Xcode.app
# Of course you have to quit and restart Xcode for this
# to take effect
NOTE: This change will be undone by installation/update/removal of the
Xcode application. This change applies to ALL users, not just your
user account.
7. There is no 7. You're done. Assuming you've logged out and back in
since doing #4 (or used the launchctl command) or you used step #6
instead, Xcode 3 and later will now use the just-installed version of
Subversion.
8. You're already done with the Xcode portion of this exercise.
However, if you want to use the new version of Subversion you just
installed from the command line by just typing "svn" instead of "/usr/
local/bin/svn" everytime, you should make sure that either /usr/local/
bin or /opt/subversion/bin is in your PATH and that it's IN FRONT OF
the /usr/bin directory in your PATH.
----------
USING open
----------
If you use the "open" command from a Terminal shell prompt to start up
Xcode, a combination of a security feature and the way Terminal
creates its shell prompts will cause the DYLD_LIBRARY_PATH setting to
be unset inside the Terminal shell if you've used Steps 4 & 5. (NOTE:
The default X11 xterm configuration does not have this issue.)
If you plan to use the "open" command from a Terminal shell prompt to
start up Xcode, either use the alternative in Step 6 to set
DYLD_LIBRARY_PATH or make sure you set it manually in one of your
shell startup scripts.
--------------------
RUNNING /usr/bin/svn
--------------------
If you need to run the old, pre-installed subversion binaries, you
need to unset the DYLD_LIBRARY_PATH variable. If you configured with
step #6 you don't need to unset anything. If you configured with
steps 4 & 5 and are using a non-Terminal.app shell provider (such as
xterm) or have manually set DYLD_LIBRARY_PATH in one of your shell
startup scripts, you'll need to unset it before running any of the /
usr/bin/svn* binaries as follows:
unset DYLD_LIBRARY_PATH
---------
UNINSTALL
---------
To remove, follow the "Uninstallation Notes" from the Subversion
installation package:
"To uninstall the Subversion Universal binary, just remove the /opt/
subversion directory and unlink all symlinks in /usr/local/bin
pointing to /opt/subversion/bin."
then delete the two defaults keys (if you did steps 4 & 5):
defaults delete ~/.MacOSX/environment DYLD_LIBRARY_PATH
plutil -convert xml1 ~/.MacOSX/environment.plist
defaults delete com.apple.Xcode XCSubversionToolPath
remove the launchctl setenv entry (only necessary if you used the
launchctl setenv command and haven't logged out since then):
launchctl unsetenv DYLD_LIBRARY_PATH
remove the Xcode.app Info.plist changes (if you did step 6):
defaults delete \
/Developer/Applications/Xcode.app/Contents/Info \
LSEnvironment
plutil -convert xml1 \
/Developer/Applications/Xcode.app/Contents/Info.plist
/System/Library/Frameworks/CoreServices.framework/\
Frameworks/LaunchServices.framework/Support/lsregister \
-v -f /Developer/Applications/Xcode.app
NOTE: You don't have to logout for this to take effect if you've
removed the /opt/subversion directory.
----------------------
MERGE TRACKING SUPPORT
----------------------
Presumably you want to use Subversion 1.5/1.6 for the excellent merge
tracking capabilities. In order to prevent clients without merge
tracking support (i.e. versions 1.4 and earlier) from being able to
commit changes without merge tracking information (and thereby
hindering use of the merge tracking support), you need to add a "start-
commit" hook to your repository to prevent pre-1.5 clients from being
able to commit.
Add the following start-commit script to the hooks subdirectory of
your repository:
---------- CUT HERE ----------
#!/bin/sh
case ":$3:" in *:mergeinfo:*) :;; *)
echo 'A version 1.5 or later client (mergeinfo support)' \
'is required to commit' >&2
exit 1
esac
exit 0
---------- CUT HERE ----------
For example, if you had done "svnadmin create /tmp/foo" to create your
Subversion repository, then you would need to create the start-commit
file as "/tmp/foo/hooks/start-commit" with the contents from between
the CUT lines above and then make sure it has read and execute
permissions for everybody with the "chmod a+rx /tmp/foo/hooks/start-
commit" command.
I have used the above method successfully with Xcode 3.1.2 and
Subversion installers from open.collab.net for version 1.5.5, 1.5.6,
1.6.0 and 1.6.1 of Subversion (but you want to avoid 1.6.0 and 1.6.1
for reasons mentioned above).
Kyle
P.S. Some lines meant to be entered in the Terminal or in a shell
script have been wrapped using the \ line continuation character to
(hopefully) avoid getting mangled by gratuitous wrapping courtesy of
the email / mailing list software. You can use these lines as is --
paste them wholesale all-at-once into a Terminal shell prompt window
or enter them manually -- when you press return after the \ you will
be prompted for the rest of the line or you can manually unwrap them
(remove the \ and then place the contents of the following line where
the \ was being careful not to add any extra spaces that weren't
already there before the \ or at the beginning of the next line).
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden