Tips: Any technical article has a time limit, and the “Build mobile AD Attribution System manually from Zero to one” series will do its best to provide the technical background and context. Please be sure to read the article before you refer to it, so as not to be misleading
The story background
The demo uses SVProgressHUD and AFNetworking libraries. Both libraries are installed through CocoaPods, the iOS dependency management tool. So to compile the project you need to install CocoaPods on macOS 10.15
Technical preparation
MacOS10.15 RVM is used to install the new ruby version ruby 2.6.6 to install CocoaPods
The installation process
Use the following command to install at first, but keep reporting errors
sudo gem install -n /usr/local/bin cocoapods
Copy the code
ERROR: Error installing cocoapods:
ERROR: Failed to build gem native extension
Copy the code
The ruby version may not be compatible, but many users pointed out that the system should not use the native Ruby, you need to manually install a new one
Install RVM
To reinstall Ruby, start with RVM, which is a convenient tool for managing and switching between multiple versions of Ruby environments. However, many tutorials on the web have failed and this command will not succeed
curl -sSL https://get.rvm.io | bash -s stable
Copy the code
Since the resource at this address is no longer accessible, install it using the following command
curl -sSL https://gitee.com/shuzibanshou/Lionsu-iOS-SDK/raw/main/rvm-installer.sh | bash -s stable
Copy the code
The installation is complete
Upgrade of RVM in /Users/lionsu/.rvm/ is complete.
Thanks for installing RVM
Please consider donating to our open collective to help us maintain RVM.
👉 Donate: https://opencollective.com/rvm/donate
Copy the code
If the following prompts, restart the shell window or perform RVM Reload
Please open a new shell or run one of the following commands: rvm reload echo rvm_auto_reload_flag=1 >> ~/.rvmrc # OR for auto reload with msg echo rvm_auto_reload_flag=2 >> ~/.rvmrc # OR for silent auto reloadCopy the code
Installing Ruby manually
Start by looking at the available Ruby versions
rvm list known
Copy the code
[ruby -] 1.8.6 [- p420] [ruby -] 1.8.7 [- head] # security released on head [ruby -] 1.9.1 [- p431] [ruby -] 1.9.2 [- p330] [ruby -] 1.9.3 [- p551] [ruby -] 2.0.0 [- p648] [ruby -] 2.1. [10] [ruby -] 2.2. [10] [ruby -] 2.3. [8] [ruby -] 2.4. [10] [ruby -] 2.5 [8] [ruby -] 2.6 [6] [ruby -] 2.7 [2] [ruby -] 3 [0.0]Copy the code
Install 2.6.6 to upgrade a minor version of 2.6.2
RVM install 2.6.6Copy the code
If the following error occurs
RVM can not be run with `set -o posix`, please turn it off and try again
Copy the code
Then use the command
echo $SHELL
Copy the code
Check to see if the shell currently in use is sh, and if so, switch to bash or ZSH
// View all available shells $cat /etc/shell/bin/bash/bin/csh/bin/dash /bin/ ksh/bin/sh/bin/tcsh/bin/zsh // Switch to bash $CHSH -s /bin/bash // Then enter the system password and restart the shell clientCopy the code
Ruby 2.6.6 was successfully installed
Install of Ruby - rdoc testrb rake Install of Ruby - rdoc testrb rake built without documentation, to build it run: rvm docs generate-riCopy the code
Everything is ready for installation
Then install CocoaPods and you’re done
sudo gem install -n /usr/local/bin cocoapods
Copy the code
Freemarkerdocumentation for Ruby-Machi-1.4.0 Installing ri Documentation for Ruby-Machi-1.4.0 Parsing Cocoapods-1.10.1 Done Installing ri documentation for concurrent-Ruby, i18n, .. 34 Gems Installed $POD -- Version 1.10.1Copy the code
Installation successful!