Installing Ruby on Rails for Mac. This page provides the simplest instructions for installing Ruby on Rails 3.0.x on a Mac computer. It has been most recently tested on a Mac Mini running Lion (10.7). The instructions will probably work provided that the Mac already has Ruby 1.8.7 installed. How do I install RubyGems on my Mac? I tried to run $ gem install rubygems-update with no luck. It returns ERROR: While executing gem. (Gem::FilePermissionError) You don't have write.
Install Golang with Homebrew:
When installed, try to run go version
to see the installed version of Go.
Setup the workspace:
Add Environment variables:
Go has a different approach of managing code, you'll need to create a single Workspace for all your Go projects. For more information consult : How to write Go Code
First, you'll need to tell Go the location of your workspace.
We'll add some environment variables into shell config. One of does files located at your home directory bash_profile
, bashrc
or .zshrc
(for Oh My Zsh Army)
Then add those lines to export the required variables
Create your workspace:
Create the workspace directories tree:
Hello world time!
Create a file in your $GOPATH/src
, in my case hello.go
Hello world program :
Run your first Go program by executing:
You'll see a sweet hello, world stdout
If you wish to compile it and move it to $GOPATH/bin
, then run:
Since we have $GOPATH/bin
added to our $PATH
, you can run your program from placement :
Prints : hello, world
Some References and utilities:
Import a Go package:
You can create Go package, as well importing shared ones. To do so you'll need to use go get
command
The command above should import github.com/gorilla/mux
Go package into this directory $GOPATH/src/github.com/gorilla/mux
You can then use this package in your Go programs by importing it. Example:
Format your Go code
Go has a tool that automatically formats Go source code.
OR
Godoc : The documentation tool
Using the godoc
command, you can generate a program documentation.
You need to respect some spec in order to document using godoc
. You can read more about : godoc Documenting Go code
Discovering more the language:
The following interactive tutorial will let you discover Golang world : A tour of Go
Question or issue on macOS:
A while back it was a nightmare for me trying to get Eigen up and running on my mac for XCode, but a friend managed to figure it out and shared the instructions with me. I don’t want anyone to go through what I went through, so here’s an easy-to-follow guide.
How to solve this problem?
Solution no. 1:
1. Install Homebrew
• Package manager for Mac, allows you to download pretty much anything with
one Terminal command. Follow steps here.
2. Install Eigen
• Simply run the following command in Terminal: brew install eigen
• Eigen is now installed.
• Make note of the file path that is printed out on the command line! You’ll need that later and it can vary from person to person.
• Homebrew saves Eigen files in /usr/local/include/eigen3/
3. Include Eigen files in your Xcode project’s Build Path
• Open the project you want to use Eigen with.
• Select your project’s build target under TARGETS
• Select the Build Settings tab.
• Scroll down to Apple LLVM 7.0 – Custom Compiler Flags Note that your version of the LLVM compiler may be different.
• Double click the blank space to the right of Other C++ Flags.
• Add the directory where Eigen files are located in the filepath you noted back in step 2 (-I <filepath>
).
• Search for HEADER_SEARCH_PATHS in your target build settings and add /usr/local/include/eigen3/
the same way you added the Eigen file path to OTHER_CPLUSPLUSFLAGS
.
Your project should be able to use Eigen with no issues now.
Solution no. 2:
Rubygems Issues For Mac Os
This worked for me, and seems a lot easier than the above. It’s a little old-school, but no homebrew or package installer necessary. It literally took me less than 5 minutes.
Download Eigen and unpack.
http://eigen.tuxfamily.org/index.php?title=Main_Page#DownloadCopy the “Eigen” folder into
/usr/local
directory. I sudo’d to root and did this in the terminal, because Macs are picky about what they let you see in finder. Like I said, old-school.
2a. Note: You might have to chmod
the permissions to 755.
- In your project, go to “Build Settings” and search for “Header Search Paths.” Add /usr/local/. Eigen is a header-only library!
See Full List On Bundler.io
- Include Eigen like so