Friday, July 27, 2018

How to solve in macOS High Sierra xcrun: error: invalid active developer path /Library/Developer/CommandLineTools

I was just trying in my friend computer downgrade her npm version from 9.5.0 to 8.11.3, and suddenly I had to face an error:

(xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools))

I didn't know that she hadn't installed Xcode CommandLine, so, this is the way to do that:

xcode-select --install

So, that's all. Good luck.

Thursday, June 7, 2018

How to set environment variables on MacOS?

There are two ways to set environment variables on MacOS (and I assumed is the same in linux):

1. Temporary
The easy and fast way to set an environment variable, and is perfect that tasks that required one of those.
export [VARIABLE_NAME]=[PATH]
Example:
export JAVA_HOME=/usr/libexec/java_home
Another example is when is required add a path to the PATH variable, without lost the current content:
export PATH=/THE/NEW/FOLDER/:$PATH
Unfortunately, is our terminal is closed, we lost the variables previously settled.

2. Permanently
If we need to keep the variables in a permanent way, we need not only use export command, but using on a file called .bash_profile. This file must be on the user folder, and normally it doesn't exist, so, we need to create it with our favorite editor, or using this command:
touch ~/.bash_profile
Inside this file we need to put all the path using export that we want:
export JAVA_HOME=/usr/libexec/java_home 
export PATH=/Users/username/Library/Android/sdk/platform-tools:$PATH
This file looks like:

That's all.

Sunday, January 14, 2018

Cannot load underlying module for 'SideMenu'

I'm implementing SideMenu pod in a Swift project using only code.

I did the basic setup installing the pod (I've already got cocoapod installed):

pod init
open -a Xcode Podfile

For me, the podfile configuration in the official page doesn't work, so, I made a little modification:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '11.2'
use_frameworks!

target 'SideMenuCodeImplementation' do
pod "SideMenu"

end

Where SideMenuCodeImplementation is my project name. Then, I execute the last command:

pod install

But, when I started the implementation, at trying import SideMenu, I only got the message

Cannot load underlying module for 'SideMenu'

The solution was simple: Clean (Shift+Command+K) and build (Command+B) the project.

That's all.