📜 ⬆️ ⬇️

SVN on Mac

image
Having bought Mac, I was puzzled by installing software on it, which I had before on my PC. It was possible to transfer almost everything. For something, there were Makov versions, for something I managed to pick up a replacement. Problems arose with Subversion (SVN). On a PC, I used Visual SVN Server, which requires almost no configuration and works immediately after installation. There was no such pleasure on the Mac, so I had to tinker a bit.

So, here is what I did:
  1. There are several SVN builds for Mac OS X. I chose a version from MacPorts for myself. There were a number of reasons for this. The version there is offered the latest. In addition to SVN via MacPorts, many other useful Open Source projects are available. This includes, for example, MySQL, which I also need. Download MacPorts from here .

    After downloading the dmg file, mount the image if it was not automatically mounted. Then run the pkg file that is inside. MacPorts will install on your computer.

  2. After installation, it is advisable to check for updates. To do this, enter in the terminal:
    ')
    sudo port -v selfupdate

    If a new version is available, an update will occur. If you downloaded the latest version, you can skip this step.

  3. Download SVN. To do this, enter in the terminal:

    sudo port install subversion

    It will take some time. When finished, SVN will be installed. All necessary variables will be added to the PATH. You can test the installation by typing

    svn --version

    Something like this should appear:

      svn, version 1.5.6 (r36142)
        compiled Mar 14 2009, 20:50:37
    
     Copyright (C) 2000-2008 CollabNet.
     Subversion is an open source software, see http://subversion.tigris.org/
     This product includes software developed by CollabNet (http://www.Collab.Net/).
    
     The following repository access (RA) modules are available:
    
     * ra_neon: Module for accessing a repository via WebDAV protocol using Neon.
       - handles 'http' scheme
       - handles 'https' scheme
     * ra_svn: Module for accessing a repository using the svn network protocol.
       - with Cyrus SASL authentication
       - handles 'svn' scheme
     * ra_local: Module for accessing a repository on local disk.
       - handles 'file' scheme
     * ra_serf: Module for accessing a repository via WebDAV protocol using serf.
       - handles 'http' scheme
       - handles 'https' scheme 


  4. Now you need to transfer your repositories from the PC. To do this, I created the Repositories folder in the root of the system drive and copied all the repositories from the PC to it. If you did not have a repository before, you can create them with the svnadmin create command. For example, svnadmin create /Repositories/MyRepo . I will not describe in detail the process of creating a repository. You can see here .

  5. Starting the SVN server is simple, for this you need to enter in the terminal

    svnserve -d -r < >

    In our case:

    svnserve -d -r /Repositories

    This command starts the SVN daemon. After that, you can access the repositories on the network. For example:

    svn://svnserver/MyRepo

  6. Now we come to the most interesting. I fussed with it the longest. The problem is that the SVN server does not start automatically when the computer starts. This can be corrected using launchd, the standard autorun method on Mac. To do this, create a file.

    /Library/LaunchAgents/org.tigris.subversion.svnserve.plist (you can choose the name of your choice):

     <? xml version = "1.0" encoding = "UTF-8"?>
     <! DOCTYPE plist PUBLIC "- // Apple Computer // DTD PLIST 1.0 // EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
     <plist version = "1.0">
     <dict>
       <key> Disabled </ key>
       <false />
       <key> Label </ key>
       <string> org.tigris.subversion.svnserve </ string>
       <key> ProgramArguments </ key>
       <array>
           <string> / opt / local / bin / svnserve </ string>
           <string> - inetd </ string>
           <string> - root = / repositories </ string>
       </ array>
       <key> ServiceDescription </ key>
       <string> Subversion Standalone Server </ string>
       <key> Sockets </ key>
       <dict>
         <key> Listeners </ key>
         <array>
           <dict>
             <key> SockFamily </ key>
             <string> IPv4 </ string>
             <key> SockServiceName </ key>
             <string> svn </ string>
             <key> SockType </ key>
             <string> stream </ string>
           </ dict>
           <dict>
             <key> SockFamily </ key>
             <string> IPv6 </ string>
             <key> SockServiceName </ key>
             <string> svn </ string>
             <key> SockType </ key>
             <string> stream </ string>
           </ dict>
         </ array>
       </ dict>
       <key> inetdCompatibility </ key>
       <dict>
         <key> Wait </ key>
         <false />
       </ dict>
     </ dict>
     </ plist> 

    It is important to specify the full path to svnserve. In my case, this is / opt / local / bin / svnserve. Without this, everything will work crookedly. If you do not need the IPv6 configuration, you can delete the corresponding dict block.

    After that, the following commands are entered in the terminal to activate the configuration:

      launchctl
     load org.tigris.subversion.svnserve.plist (if you chose a different name, enter your own)
     start org.tigris.subversion.svnserve
     <ctrl-D> output to the terminal 

Well that's all. After that, everything worked for me. This method of autostart does not start the daemon, but uses inetd. The advantage of this method is that the process starts only when accessing the corresponding port. The system also deletes the process from memory when it sees fit. What is good.

I hope this small instruction will save you from many problems. :)

Source: https://habr.com/ru/post/55541/


All Articles