Reinstalling Appcelerator Titanium on Mac from scratch

Ok, so you updated to the latest Mac version of Appcelerator since a long time ago and now Studio is not starting, or starts with errors? CLI is not compiling anymore?

Although in my experience almost all the problems comes by incorrect versions of Node or node packages, for me the best option to solve all the problems (the one appearing now and those that will appear after resolving the one) at one blow is reinstalling from scratch.

I needed to do it the last weekend after jumping from an old 4.1.1GA version (updated also from a 3.5.0GA) to the latest 5.2.0GA: Studio didn’t start because an error and I was not able to compile with CLI. I fixed the error updating node to 4.2.2 but a new error appeared when trying to compile. So I decided to start from scratch and these are the steps I followed:

Remove Appcelerator from Applications

Drag Appcelerator folder to trash to remove the current Studio installation

Uninstall Appcelerator from command line

Open a Terminal and just type this to remove all appc related folders (except mobile SDKs and take care of your working folder):

rm -rf ~/.appcelerator
rm -rf ~/.titanium
sudo npm uninstall -g titanium
sudo npm uninstall -g alloy
sudo npm uninstall -g acs
sudo npm uninstall -g appcelerator

Probably the old titanium folders/packages will not exist, but better to be sure…

Removing Node

This is the tricky part: 90% of my problems with Studio/CLI are always because of Node, so to be sure all works as “new” you must remove all Node and Node packages. And to do this I found a great Gist from TonyMtz. Because I didn’t use brew to install node, I simply skip that step:

# Not sure what lsbom does:
lsbom -f -l -s -pf /var/db/receipts/ | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
#Probably this is enough, but to be sure execute this individual steps:
# go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*
# go to /usr/local/include and delete any node and node_modules directory
cd /usr/local/include
sudo rm -rf node*
# check your Home directory for any "local" or "lib" or "include" folders, and delete any "node" or "node_modules" from there
# go to /usr/local/bin and delete any node executable (I also, by the way, cleared here old simlinks I found)
cd /usr/local/bin
sudo rm -rf /usr/local/bin/npm
sudo rm -rf /usr/local/bin/node
ls -las
# you may need to do the additional instructions as well:
sudo rm -rf /usr/local/share/man/man1/node.1
sudo rm -rf /usr/local/lib/dtrace/node.d
sudo rm -rf ~/.npm

Ok, that’s it, after this, if you try “node -v” the response must be “error” and you don’t have Node installed anymore.

Install Appcelerator again

Now you don’t have Appcelerator installed so it is time to install it again. Just download (you must be logged) Studio if you haven’t the PKG installer from Appcelerator Platform and let it to install the right Node version for you (currently for me it installed 0.12.7) and the latest CLI.

That’s all. After finishing all your installation should be working fine. Launch Studio and set your working directory. Your preferences should be there already and look exactly like before deleting Appcelerator.

Last tip

In my case, I had some very old SDKs installed and that gave me problems detecting iOS simulators on Studio. Simply deleting old SDKs and leaving only 4.1.1 and 5.2.0 fix that problem. Fokke Zandbergen told me this is usually a problem when you have selected by default an old SDK (the command is “appc ti sdk select”). So instead of removing the SDK you can select a recent SDK and the problem should be solved.

If you want to remove old Titanium SDKs, simply go to this folder and remove the right SDKs folders:

~/Library/Application Support/Titanium/mobilesdk/osx/
Like what you read? Give Manuel Conde a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.