본문 바로가기

React Native

[ReactNative] Mac - IOS설치(npx react-native run-ios)

반응형

맥은 왜.... 비싼지... 잘 모르겠다.... 

그래도 ios를 개발하려면 mac을 사야했다... 산거 열심히 해보자

다음에 기회가 된다면 swift도 익혀보고 싶다.

 


node, watchman 등이 필요하다.

 

1. node, watchman 설치

 

node설치
brew install node

watchman설치
brew install watchman

 

2. Cocoapods설치 

 

sudo gem install cocoapods

cocoapods를 설치하고 환경 변수 설정을 해줘야 한다.

.bash_profile이나 .zshrc파일에

export GEM_HOME=$HOME/.gem
export PATH=$GEM_HOME/bin:$PATH

를 추가해주고 저장(source 폴더명)해주자

 

 

3. Xcode설치

App store에서 Xcode를 설치해주자.

 

설치후에 Preference > Location > Command Line Tools 에서 원하는 거를 다운받아주자

Xcode

이제 기본은 끝났다 실행을 해보자

 

생성

npx react-native init [파일명]

예시
npx react-native init tencoding

위처럼 입력을 하면 tencoding이라는 react-native 프로젝트가 생성된다. 

 

 

실행

Start Metro
npx react-native start

Start your application
npx react-native run-ios

하면 된다!

(android설정을 따로 안했기 때문에 "npx react-native run-android"는 아직 실행이 안됩니다.)

 

 

모두들 열코합시닿ㅎㅎㅎ 화이팅~!~!

 

 

 

 

 

참고:reactnative.dev/docs/environment-setup

 

Setting up the development environment · React Native

This page will help you install and build your first React Native app.

reactnative.dev

 

반응형