169
133

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

macのrailsサーバーにスマホ実機でアクセスする

Last updated at Posted at 2020-02-04

macローカルでrailsウェブサービスを作ってて、スマホ実機でテストしたいとき。
エミュレータでもいいけど、実機じゃないとテスト出来ないときってありますよね...

1. mac、スマホを同じwifiに繋ぐ

2. macのローカルIPを調べる

ネットワーク環境設定で確認。↓の場合は192.168.11.8

ip.png

3. IP指定でrailsサーバーを立ち上げる

IPが192.168.11.8の場合

bundle exec rails s -b 192.168.11.8

(-bオプションでIP指定できます)

4. スマホでアクセス

以下の様なURLにスマホでアクセスすればOK。
http://192.168.11.8:3000/

169
133
4

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
169
133

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?