Making a program use a specific network interface

Solution 1:

Add a static route for your irc server. For example I have 2 interfaces: wired (en0) and WiFi (en1) of which the wired one is the default. So if I get a route to a server, it will go through the default interface (see interface line in output) :

MacMini:~ root# netstat -rn | grep -i default
default            10.0.0.1           UGSc          198       10     en0
default            172.20.10.1        UGScI           0        0     en1

MacMini:~ root# route get tyr.be
   route to: squarespace.com
destination: squarespace.com
    gateway: 10.0.0.1
  interface: en0
      flags: <UP,GATEWAY,HOST,DONE,WASCLONED,IFSCOPE,IFREF>
 recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu     expire
       0         0         0         0         0         0      1500         0

But if I add a static route through the WiFi interface en1 however :

MacMini:~ root# route add 65.39.205.54/32 172.20.10.1
add net 65.39.205.54: gateway 172.20.10.1

MacMini:~ root# netstat -rn | grep -i 65.39.205.54
65.39.205.54/32    172.20.10.1        UGSc            1        0     en1

MacMini:~ root# route get tyr.be
   route to: squarespace.com
destination: squarespace.com
  interface: en1
      flags: <UP,HOST,DONE,LLINFO,STATIC>
 recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu     expire
       0         0         0         0         0         0      1500         0

The route will disappear every time you reboot. To make it permanent you would have to create a script launched as a startup item or a custom launchd script.