Start up Cache instance on OSX

Hi, everybody
I am newbie at OSX and I am trying to install Cache on my mac

At first time I just executed in Shell Terminal next line
$ sudo /Users/Alex/Downloads/cache-2016.2.0.627.0-macx64/cinstall 
And there was no problems with instalation.
But few day after first try I've decided to update it to 2016.2.0.719.0 and I deleted previously installed version by "sudo rm -r <directory>" and only then I've tried to google "how to uninstall cache" and learned that I have had to stop instances and delete them by ccontrol first. My fault. Just in case it helps I did it
Then I.ve tried to execute next line 
sudo /Users/Alex/Downloads/cache-2016.2.0.719.0-macx64/cinstall 
Installation was going normally but then on task "Starting up Cache" next error was printed in terminal

Error: ERROR #5001: Could not start SuperServer on port 1972, may be in use by another instance - Shutting down the system
An error was detected during Cache startup.
** Startup aborted **

And "ccontrol start" prints the same error

$ ccontrol start cache
Starting CACHE
using 'cache.cpf' configuration file

Starting Control Process
Automatically configuring buffers
Allocated 363MB shared memory: 256MB global buffers, 35MB routine buffers
This copy of Cache has been licensed for use exclusively by:
License missing or unreadable.
Copyright (c) 1986-2016 by InterSystems Corporation
Any other use is a violation of your license agreement

Error: ERROR #5001: Could not start SuperServer on port 1972, may be in use by another instance - Shutting down the system
An error was detected during Cache startup.
** Startup aborted **

Can someone help me with this issue.

I have been Windows user, and I did not faced with any similar issues.

Answers

Such error you can face on a windows as well. Your super port has already in use by another instance of Cache. And you can change port for new instance, by editing cache.cpf file in the root of installed Cache. 

To be sure that port is in use you can use some network tools, such as netstat

netstat -na | grep 1972
tcp4       0      0  *.1972                *.*                    LISTEN

or lsof, which can show which process with pid uses this port

sudo lsof -i tcp:1972
cache   14960 cacheusr    4u  IPv4 0x768e107dffb0f4df      0t0  TCP *:1972 (LISTEN)

 

Your super port has already in use by another instance of Cache. 

How it can be if "ccontrol list" prints next

$ ccontrol list

 

Configuration 'CACHE'

directory: /Users/Alex/work/cache

versionid: 2016.2.0.719.0

conf file: cache.cpf  (SuperServer port = 1972, WebServer = 57772)

status:    down, last used Sat Aug 27 17:13:55 2016

 

Could you tell me how to remove all remaining traces of the previous instance

Thanks in advance.

does not matter what `ccontrol list` shows, may be you just removed instance from this list

if you removed this folder, try to restart machine, and check output with commands, which I gave you

Thank you

Restart of machine helped, didn't thought that it would help 

Hi Alexander,

 

The problem was: with just removing the directory, the processes are still hanging around. So the 1972 port was still in use by the original cache instance. 

Restarting removed that process, that's why it solved the issue. Part of Dmitry's answer was useful in such as you can use lsof to determine which process holds a handle on a port. 

 

Please let me know if you have any further questions about this!

 

HTH,

Fab