Monthly Target: $400 Donations: $221
 55% 

Source Dedicated Server for Mac OS X


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DS
SourceMod Developer
Join Date: Sep 2004
Location: WI, USA
Old 06-02-2011 , 02:48   Source Dedicated Server for Mac OS X
Reply With Quote #1

Since Valve has decided not to release SrcDS for OS X, I took things into my own hands.

I noticed that a "dedicated.dylib" binary was included for most available Source engine games. This binary is what handles the logic for dedicated servers. I hoped that I could do something with it and I have -- but not without a lot of hacks.

My primary motivation for this was to make testing easier (for Metamod:Source and SourceMod). I find it nice to be able to develop and test without needing to run the full games on listen servers. This also has the advantage of being able to run inside a virtual machine that lacks the necessary hardware acceleration.

Hopefully someone else out there will find this useful. If you have any problems or questions, feel free to post them.

Downloads
Source Code
Special Thanks
  • pRED: Created CDetour
  • psychonic: Checked dyld symbols on 10.5 and tested under virtual machine
  • Fyren: Pasted some vital output from srcds and gdb on Linux
  • Open Steamworks

General Guidelines

There are essentially two options for running a server. You could run it directly from the game's install directory in SteamApps (usually ~/Library/Application Support/Steam/SteamApps/common/<game>). Or you may opt to have a separate copy of the game by copying it either from the SteamApps/common directory or from a SteamCMD install on a Windows or Linux system (assuming Mac binaries are available from it).

Once you have downloaded the appropriate package for your game listed above, place the srcds_osx and srcds_run files from it into the server's root directory. If the package also includes a bin directory, copy the files from it to the bin directory of the server root as well.

Counter-Strike: Source Example

  • Note: The Library folder may be hidden in Finder by default on Lion (10.7) or later. To get there you can either use Finder's Go menu while holding the Option/Alt key or you can unhide it semi-permanently it by running the following Terminal command:
    Quote:
    chflags nohidden ~/Library
    You may have to reapply this nohidden flag after an OS X update.

  • Note 2: If you decide to drag and drop the bin folder in Finder, make sure to hold the Option/Alt key while doing so. On OS X Lion (10.7) and later, you should be offered the option to 'Merge' folders rather than replace. I repeat, you do NOT want to completely replace the bin folder.

Once the files from the appropriate package have been extracted/copied, you can run the server by navigating to the server root directory in Terminal:
Quote:
cd ~/Library/Application\ Support/Steam/SteamApps/common/Counter-Strike\ Source/
Then you can start the server by running srcds_run with the game name, map, and any other options you'd like:
Quote:
./srcds_run -game cstrike +map de_dust -maxplayers 16 +log on
Note: It is recommended that you run a dedicated server on the same system that has the Steam client installed. Steam does NOT have to be running at the same time, however. But if you really want to run it on a computer that doesn't have the Steam client, see the Running Server Without Steam Client section at the bottom of this post.

Example Server Output

Note on Counter-Strike: Global Offensive

The dedicated.dylib binary is not included in the OS X client download of the game, but this is still required to run a server. You may use the following download of dedicated.dylib as a starting point, but I can't guarantee that it will be kept up to date: dedicated.dylib (last updated: 30 June 2014)

It is instead recommended that the file be obtained from a dedicated server install (appid 740) via SteamCMD on Windows or Linux (or Wine on OS X). Alternatively, you could use Depot Downloader with Mono. Either way, the file should be located in the bin directory of the server's root directory.

You may even want to download the entire server via SteamCMD or Depot Downloader rather than the Steam client because all the Mac binaries are included. (The download package above is still required, of course).

Note on Insurgency

You may use the client install of the game to run a server, but Mac binaries are also included in the dedicated server install. You can download this in the Tools section of the Steam client. It's currently labeled Insurgency Beta Dedicated Server. Note that if you use the dedicated server install, you will be overwriting/replacing the srcds_osx binary with the one included in the srcds_osx download package above.

Note on Dota 2

It is highly recommended to install the latest snapshot of Metamod:Source and the Dota 2 Fixups plugin in order to fix a number of issues. Metamod:Source must be installed using the gameinfo.txt installation method. See this thread for more details and support.

Running Server Without Steam Client

While it is recommended to run a dedicated server on a computer with the Steam client installed, it is possible to run one without it. However, you will need to copy a number of files from an OS X Steam client install.

First, from /Applications/Steam.app/Contents/MacOS, copy the Frameworks directory to your server's root directory (NOT bin).

Next, from the osx32 directory (full path: /Applications/Steam.app/Contents/MacOS/osx32), copy the following files into the bin directory of your server's root: crashhandler.dylib, libsteam.dylib, libtier0_s.dylib, libvstdlib_s.dylib, and steamclient.dylib.

After you've copied these files, you should be able to run the server as described above.
Attached Files
File Type: gz srcds_osx-csgo.tar.gz (46.4 KB, 1374 views)
File Type: gz srcds_osx-left4dead.tar.gz (16.3 KB, 111 views)
File Type: gz srcds_osx-left4dead2.tar.gz (15.0 KB, 291 views)
File Type: gz srcds_osx-garrysmod.tar.gz (112.9 KB, 914 views)
File Type: gz srcds_osx-insurgency.tar.gz (45.3 KB, 209 views)
File Type: gz srcds_osx-nucleardawn.tar.gz (200.0 KB, 111 views)
File Type: gz srcds_osx-tf2.tar.gz (112.8 KB, 1263 views)

Last edited by DS; 06-30-2014 at 15:40. Reason: Updated csg
DS is offline
asherkin
Fennec Fox
Join Date: Aug 2009
Location: OnGameFrame()
Old 06-02-2011 , 02:56   Re: Source Dedicated Server for Mac OS X
Reply With Quote #2

Nice work DS!
__________________

Last edited by asherkin; 06-02-2011 at 07:51. Reason: Needed more !.
asherkin is online now
GoD-Tony
Veteran Member
Join Date: Jul 2005
Old 06-10-2011 , 03:35   Re: Source Dedicated Server for Mac OS X
Reply With Quote #3

Wow this is very nice. You should sticky this in the SRCDS section so it doesn't get lost.
GoD-Tony is offline
DS
SourceMod Developer
Join Date: Sep 2004
Location: WI, USA
Old 06-15-2011 , 01:34   Re: Source Dedicated Server for Mac OS X
Reply With Quote #4

I had some time to test this on Lion (10.7) and found that it didn't work at all. There was also a problem when using the latest Steam client beta along with the -steam option on Orange Box/Source 2009 games.

Both problems have now been fixed. The source code and binaries have been updated.

It should also be noted that SourceMod will likely crash when trying to resolve symbols on Lion due to a very similar issue. I hope to have a fix for that tomorrow.
The ResolveSymbol() crash should be fixed as of 1.4-hg3296.

Last edited by DS; 06-16-2011 at 16:10.
DS is offline
KyleS
SourceMod Plugin Approver
Join Date: Jul 2009
Location: Segmentation Fault.
Old 06-21-2011 , 16:50   Re: Source Dedicated Server for Mac OS X
Reply With Quote #5

Great work!

While I realize this may seem like a silly request, but is there any chance this could be ported to Linux? I'd much rather run as much open source code as I can. While I'd like to do it myself, it would probably result in an unfinished/unstable product.
KyleS is offline
DS
SourceMod Developer
Join Date: Sep 2004
Location: WI, USA
Old 06-21-2011 , 17:07   Re: Source Dedicated Server for Mac OS X
Reply With Quote #6

Quote:
Originally Posted by KyleS View Post
While I realize this may seem like a silly request, but is there any chance this could be ported to Linux?
This would be a pretty easy thing to do since there would be no hacks required, but keep in mind, it'd only be a replacement for the srcds_linux binary. So I don't really see much point in it.

It's not as though I re-implemented the dedicated lib or any of the others for OS X. I only made use of the existing libraries with a few hacks thrown in to make it work.
DS is offline
KyleS
SourceMod Plugin Approver
Join Date: Jul 2009
Location: Segmentation Fault.
Old 06-22-2011 , 02:51   Re: Source Dedicated Server for Mac OS X
Reply With Quote #7

I know nothing has been rewritten gamewise. I'm more after inner binary loading instead of using LD_PRELOAD which has some marginal overhead per call.

I love customization
KyleS is offline
neo_gis
Member
Join Date: Sep 2009
Location: Rabat
Old 07-17-2011 , 15:45   Re: Source Dedicated Server for Mac OS X
Reply With Quote #8

thx a lot for this ! saved me the trouble of running srcds through parallels ...
__________________
neo_gis is offline
Send a message via MSN to neo_gis Send a message via Skype™ to neo_gis
oday91
Junior Member
Join Date: Jun 2011
Old 07-19-2011 , 11:04   Re: Source Dedicated Server for Mac OS X
Reply With Quote #9

nice
__________________
oday91 is offline
ajstorey915
New Member
Join Date: Jul 2011
Old 08-09-2011 , 17:59   Re: Source Dedicated Server for Mac OS X
Reply With Quote #10

I am trying to use this dedicated server by adding to my current Steam CS:S installation and I cannot get it to work correctly. I am running 10.7.

When I try and start the server I get the following error.

##### Sys_Error: Host_Error: IDLLFunctions:LLInit returned false
ajstorey915 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:20.


Powered by vBulletin®
Copyright ©2000 - 2015, vBulletin Solutions, Inc.
Theme made by Freecode