In OSX, run the following in a shell:
sudo lsof -nP -iTCP:1025 -sTCP:LISTEN
The expected output of this command is a process, which is listening on port 1025:
ruby 43841 youruserid 9u IPv4 0x6a1610da80bb9b4f 0t0 TCP 127.0.0.1:1025 (LISTEN)
In the output above, the 2nd value is the process ID. Then, to kill the offending process (substitute in the correct PID):
sudo kill 43841