<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Vanessa Soares</title>
    <description>The latest articles on Forem by Vanessa Soares (@vanessafsoares).</description>
    <link>https://forem.com/vanessafsoares</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F275424%2F5f357f64-ac57-4dc2-9787-b45b8a93307a.jpg</url>
      <title>Forem: Vanessa Soares</title>
      <link>https://forem.com/vanessafsoares</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/vanessafsoares"/>
    <language>en</language>
    <item>
      <title>Start emulator and simulator from macOS terminal</title>
      <dc:creator>Vanessa Soares</dc:creator>
      <pubDate>Fri, 02 Jul 2021 17:46:12 +0000</pubDate>
      <link>https://forem.com/vanessafsoares/start-emulator-and-simulator-from-macos-terminal-22fb</link>
      <guid>https://forem.com/vanessafsoares/start-emulator-and-simulator-from-macos-terminal-22fb</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnj8fxpqz3dtr44hit9fx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnj8fxpqz3dtr44hit9fx.png" alt="Simulators"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you like use the terminal and knows how slow it is for macOS to open Xcode and Android Studio in an attempt to get the emulators/simulators started, this article is for you.&lt;/p&gt;

&lt;p&gt;Before going to the tutorial, make sure you have Xcode and Android Studio properly installed with their command line tools on your macOS.&lt;/p&gt;

&lt;p&gt;With these two NPM packages that can help you, it's &lt;code&gt;start-ios-simulator&lt;/code&gt; &amp;amp; &lt;code&gt;start-android-emulator&lt;/code&gt;. Run the following commands to install:&lt;/p&gt;

&lt;p&gt;For android emulator:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

npm install -g start-android-emulator


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;For iOS simulator:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

npm install -g start-ios-simulator


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;For android just run the command below and it will not only list the emulators available to start, it will also ask you if you intend to clean the device's data to start it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhh0vuqib9ryl6ids0pvp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhh0vuqib9ryl6ids0pvp.png" alt="Terminal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the iOS simulator you will have all the options available to start.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1xw1j927nerqasppzlrj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1xw1j927nerqasppzlrj.png" alt="Terminal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Starting Android Emulator
&lt;/h1&gt;

&lt;p&gt;You can also run the default emulator command that's in that &lt;a href="https://developer.android.com/studio/run/emulator-commandline?hl=en#starting" rel="noopener noreferrer"&gt;developer.android.com&lt;/a&gt; doc.&lt;/p&gt;

&lt;p&gt;To list emulators:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

emulator -list-avds


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Just reference the device's compiler path, start the emulator and specify the device name.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

/Users/seu.user/Library/Android/sdk/emulator/emulator -avd Pixel_2_API_29 -netdelay none -netspeed full


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;In your .bash_profile file you can even create an alias to run just a short command in the terminal.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

export ANDROID_HOME=/Users/{YourUsername}/Library/Android/sdk/
alias run-emulator=”$ANDROID_HOME/emulator/emulator @Pixel_XL_API_27"


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h1&gt;
  
  
  Start iOS Simulator
&lt;/h1&gt;

&lt;p&gt;Apple has &lt;code&gt;simctl&lt;/code&gt; binary for interacting with iOS simulators from the command line. It's very similar to adb for Android. We can access all available options using the help command.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

$ xcrun simctl help


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;List all simulators:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

xcrun simctl list --json


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;To launch the simulator app:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;If you want to start a specific simulator, just find the id listed in the &lt;code&gt;xcrun sumctl list — json&lt;/code&gt; command and run the command:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

xcrun simctl boot BE53CBFF-4900–4F10-A1D4-B451AB4C9E7E
open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>android</category>
      <category>ios</category>
      <category>mobile</category>
      <category>testing</category>
    </item>
  </channel>
</rss>
