markdownmacosxrails开发环境设置(代码片段)

author author     2022-12-16     765

关键词:




# Mac OS X Rails Dev Environment Setup

**Prerequisite:** Be sure to have the latest Xcode installed before proceeding.

 ## Install Homebrew
 
Homebrew is the defacto package manager on the OS X platform 

	/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"


 ## Install Mathias’s dotfiles
 
Sensible hacker defaults for macOS.  [More info](https://github.com/mathiasbynens/dotfiles)
	   
	git clone https://github.com/mathiasbynens/dotfiles.git && cd dotfiles && source bootstrap.sh
	
Adds some great features like a bunch of really handy aliases. 
	Some you can try yourself:  
		
	# To list all files including hidden, with forward-slash to denote folders.
	la 
		
	# To show hidden files in Finder
	show
	
	# To hide hidden files in Finder
	hide

	# To view all the aliases now available for your use
	alias


Add the `.extra` as detailed [here](https://github.com/mathiasbynens/dotfiles)

Be sure to check the changes that the `.macos` scipt makes before using it to set some sensible macOS defaults. You may want to comment some out.

 ## Setup Terminal
 

 - Open **Preferences** for the **Terminal** app. 
 - Under **Profiles** select **Import** via the settings cog at the bottom of the pane. 
 - From there, import the _Solarized Dark xterm-256color.terminal_ profile. 
 - Now select the imported profile in the list and make it the default by clicking the **Default** button at the bottom of the pane. 
 - Restart the **Terminal** app for the new profile to be enabled.



## Setup the Ruby & Rails Environments

 1. Install **rbenv** 
		  
	 [rbenv](https://github.com/rbenv/rbenv) allows  for easily installation and switching between various versions of Ruby. More 
		
	Install **rbenv**.
		
		brew install rbenv		
		
	Set up **rbenv** integration with your shell.
		
		rbenv init

	Make **rbenv** load automatically.
		
		if ! grep -i 'eval "$(rbenv init -)"' ~/.bash_profile ; then echo 'eval "$(rbenv init -)"' >>  ~/.bash_profile ; fi
			
	Refresh the **Terminal**.
		
		reload 
	
	Check that **rbenv** is setup correctly
	
		curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash

	You should get something like this.
		![enter image description here](https://image.prntscr.com/image/DdJUSTNJRUGNej4DFzR6bg.png)
			
 2. Install **Ruby**
		 
    *Install the version you require*
		 
	    rbenv install 2.4.1
		
	Set the global Ruby version
	
	    rbenv global 2.4.1
	Check that it's set
	
		ruby -v
			
	It should return the version you set.	
	![enter image description here](https://image.prntscr.com/image/6RAtKo7eSpa4asGRe3I7Dg.png)

 3.  Install **Bundler**
	 
		[Bundler](http://bundler.io/) is a [Gem](http://guides.rubygems.org/rubygems-basics/) manager.
			
		 gem install bundler
	 
 4. Set **Gem** docs generation exclusion.
	
    	if ! grep -i 'gem: --no-ri --no-rdoc --no-document' ~/.gemrc ; then echo 'gem: --no-ri --no-rdoc --no-document' >>  ~/.gemrc ; fi
			
5. Install **Rails**
	
	   gem install rails



## Setup Postgres
  

 1. Install **Postgres.app**
 
	  Download from [here](https://postgresapp.com/) , install, open and select `Initialize`
	  
 2. Set the `$PATH`for  command line use.
 
		sudo mkdir -p /etc/paths.d && echo /Applications/Postgres.app/Contents/Versions/latest/bin | sudo tee /etc/paths.d/postgresapp && reload


## Create Test Rails App

   Here we will  create simple blog app
			
	# Create a project directory  
	mkdir -p ~/Projects/RailsApps
	cd ~/Projects/RailsApps

	# Create a new app preconfiguring postgres as the database
	rails new my_blog -d postgresql
	cd my_blog

	# Scaffold a Post MVC
	rails generate scaffold Post title:string body:text
		
	# Create the db & run migrations
	rails db:create db:migrate

	#Start the server
	rails server

 Check that the app is running at http://localhost:3000/
		 ![enter image description here](https://image.prntscr.com/image/F5a5bLJQQOaXPZgfVwJQmA.png)
		
Check that 	you can create, edit & delete Posts http://localhost:3000/posts

2-3flutter开发环境与ios开发环境设置(mac)

Mac下环境搭建先不看了都是Mac下的环境搭建  查看详情

flutter开发环境与android开发环境设置(代码片段)

...)3.获取FlutterSDK3.1下载安装包3.2配置环境变量3.3Android开发环境设置3.3.1创建androi 查看详情

如何设置 TrustZone 开发环境

】如何设置TrustZone开发环境【英文标题】:HowtosetupaTrustZonedevelopmentenvironment【发布时间】:2018-06-1923:03:16【问题描述】:我想开始玩ARMTrustZone,所以我想设置一个开发环境,不幸的是我觉得我仍然缺少一些东西,我不知道如何将... 查看详情

shmac开发环境设置(代码片段)

查看详情

markdownubuntulamp开发环境设置(代码片段)

查看详情

markdownubuntulamp开发环境设置(代码片段)

查看详情

blog开发环境环境设置

所需要环境:  win10  python2.7.10  django1.10.6  mysql    mysql-python   pillow ├─.idea├─blog│└─migrations├─Blog_project├─static└─templatessetting设置LANGUAGE_CODE=‘zh-hans‘#语言TIME_ZONE=‘A 查看详情

设置 MobileFirst 开发环境

】设置MobileFirst开发环境【英文标题】:SettingUpMobileFirstDevEnvironment【发布时间】:2016-09-1321:19:05【问题描述】:操作系统:Windows7面向Web开发人员的EclipseJavaEEIDE。版本:Mars.2版本(4.5.2)内部版本号:20160226-0632JavaJRE7Javajdk1.7.0_79Mobil... 查看详情

安装程序如何设置复杂的开发人员环境?

】安装程序如何设置复杂的开发人员环境?【英文标题】:howaboutaninstallertosetupcomplicateddeveloperenvironment?【发布时间】:2012-04-0405:04:16【问题描述】:我们的开发人员环境设置往往有很多活动部件和很多步骤。每天当我们需要进... 查看详情

bigbluebutton-设置自己的开发环境

设置开发环境欢迎来到BigBlueButton1.1的BigBlueButton开发人员指南。在设置开发环境之前,您需要安装一个工作的BigBlueButton1.1服务器(请参阅安装步骤)。概观BigBlueButton服务器是从与Ubuntu软件包相对应的许多组件构建的。这些组件... 查看详情

用于包/组件开发的 Delphi 环境设置

】用于包/组件开发的Delphi环境设置【英文标题】:DelphiEnvironmentSetupforPackage/ComponentDevelopment【发布时间】:2011-03-2303:31:27【问题描述】:在阅读了一些邮件列表和bbs之后,我找不到合适的方法来设置我的开发环境以进行包和组件... 查看详情

如何设置多开发者 Biztalk 环境?

】如何设置多开发者Biztalk环境?【英文标题】:Howtosetupamulti-developerBiztalkenvironment?【发布时间】:2010-10-2422:55:54【问题描述】:如果我们有3名开发人员在同一个Biztalk项目上工作,那么设置我们的开发环境的最佳方式是什么?我... 查看详情

springboot中如何设置不同的开发环境

通过不同的application-*.yml设置不同的开发环境当我们需要哪个配置环境时,只需要在application.properties中指定即可,如下图所示: 如下测试:@RestControllerpublicclassIndexController{@RequestMapping("/index")publicStringindex(){return"helloworld";} 查看详情

markdown打字稿开发环境设置(代码片段)

查看详情

markdown设置php开发环境(代码片段)

查看详情

如何为 UCMA 4.0 开发设置环境

】如何为UCMA4.0开发设置环境【英文标题】:HowtosetupanenvironmentforUCMA4.0development【发布时间】:2013-12-1916:50:38【问题描述】:我想开始UCMA4.0开发。我想构建一个单一的VM环境,我可以在其中安装UCMASDK的所有依赖项。是否有任何地... 查看详情

如何设置捆绑开发环境(Eclipse Equinox Maven)

】如何设置捆绑开发环境(EclipseEquinoxMaven)【英文标题】:Howtosetupbundledevelopmentenvironment(EclipseEquinoxMaven)【发布时间】:2010-11-2718:17:52【问题描述】:我正在尝试设置Eclipse环境来开发捆绑包(使用maven-bundle-plugin-bnd)并运行和调... 查看详情

vs怎么重置设置开发环境

...接重置为预设状态即可,有几种预设可选,是针对不同的开发者的,如C#、C++和Web开发本回答被提问者采纳 查看详情