{"id":916,"date":"2017-06-21T13:22:32","date_gmt":"2017-06-21T18:22:32","guid":{"rendered":"http:\/\/siever.info\/home\/?p=916"},"modified":"2019-03-16T12:20:27","modified_gmt":"2019-03-16T17:20:27","slug":"pxt-for-the-microbit-locally-on-macos","status":"publish","type":"post","link":"https:\/\/siever.info\/home\/pxt-for-the-microbit-locally-on-macos\/","title":{"rendered":"PXT for the Micro:Bit locally on macOS"},"content":{"rendered":"<p style=\"font-size:30px\"><strong>This is out-of-date.  Just follow the instructions at <a href=\"https:\/\/github.com\/Microsoft\/pxt-microbit\">https:\/\/github.com\/Microsoft\/pxt-microbit<\/a><\/strong><\/p>\n<p>I&#8217;ve been looking into the <a href=\"http:\/\/microbit.org\/\">Micro:Bit<\/a> and Microsoft&#8217;s <a href=\"https:\/\/github.com\/Microsoft\/pxt\">PXT (Programmer eXperience Toolkit)<\/a>.  PXT and all the required build tools can be installed on macOS, but the official instructions are a little weak.  Here are the required steps:  <\/p>\n<h1>Installation \/ Running<\/h1>\n<p>All these commands need to be run in a terminal:<\/p>\n<ol>\n<li>Install <a href=\"https:\/\/brew.sh\/\">Homebrew<\/a><br \/>\n<blockquote><p><code><br \/>\n\/usr\/bin\/ruby -e \"$(curl -fsSL https:\/\/raw.githubusercontent.com\/Homebrew\/install\/master\/install)\"<br \/>\n<\/code><\/p><\/blockquote>\n<\/li>\n<li>Install Node.js (using homebrew)<br \/>\n<blockquote><p><code><br \/>\nbrew install node<br \/>\n<\/code><\/p><\/blockquote>\n<\/li>\n<li>Install <a href=\"http:\/\/docs.yottabuild.org\/\">Yotta<\/a><br \/>\n<blockquote><p><code><br \/>\nbrew tap ARMmbed\/homebrew-formulae<br \/>\nbrew install python cmake ninja arm-none-eabi-gcc<br \/>\npip install yotta<br \/>\n<\/code><\/p><\/blockquote>\n<\/li>\n<li>Install srecord<br \/>\n<blockquote><p><code><br \/>\nbrew install srecord<br \/>\n<\/code><\/p><\/blockquote>\n<\/li>\n<li>Clone the pxt repo. (Replace the repo URL with the URL of a fork if desired)<br \/>\n<blockquote><p><code><br \/>\ngit clone https:\/\/github.com\/Microsoft\/pxt-microbit<br \/>\n<\/code><\/p><\/blockquote>\n<\/li>\n<li>Change your directory to be within the cloned repo.  For the above:<br \/>\n<blockquote><p><code><br \/>\ncd pxt-microbit<br \/>\n<\/code><\/p><\/blockquote>\n<\/li>\n<li>Install pxt<br \/>\n<blockquote><p><code><br \/>\nnpm install -g pxt<br \/>\nnpm install<br \/>\n<\/code><\/p><\/blockquote>\n<\/li>\n<li>Run the local pxt server.<br \/>\n<blockquote><p><code><br \/>\npxt serve<br \/>\n<\/code><\/p><\/blockquote>\n<p>This will download the needed components, do compilation, and eventually launch the PXT environment in your default browser.  Watch the terminal window though.  Downloads may exceed github limits and it may require you to paste a URL to login in and complete downloads (something like <tt>https:\/\/yotta.mbed.com\/?provider=github#login\/...<\/tt>).<br \/>\n\n<\/li>\n<\/ol>\n<h1>Adding a Library<\/h1>\n<ol>\n<li>Stop the pxt server (if running)<\/li>\n<li>Create the sub directory in <tt>ROOT\/libs<\/tt>.  Ex:<br \/>\n<blockquote><p><code><br \/>\ncd pxt-microbit\/libs<br \/>\ngit clone https:\/\/github.com\/Microsoft\/pxt-bluetooth-temperature-sensor<br \/>\nmv pxt-bluetooth-temperature-sensor bluetooth-temperature-sensor<br \/>\n<\/code><\/p><\/blockquote>\n<\/li>\n<li>Add the new directory to <tt>bluetooth-temperature-sensor<\/tt> in <tt>pxt-microbit\/pxtarget.json<\/tt><br \/>\n<blockquote><p><code><br \/>\n...<br \/>\n\"bundleddirs\": [<br \/>\n   ... ,<br \/>\n   \"libs\/bluetooth-temperature-sensor\"<br \/>\n  ],<br \/>\n   ...<br \/>\n<\/code><\/p><\/blockquote>\n<\/li>\n<li>If needed, update the <tt>pxt.json<\/tt> of the new library.  For example, for the above update the path of the dependencies:<br \/>\n<blockquote><p><code><br \/>\n...<br \/>\n    \"dependencies\": {<br \/>\n        \"core\": \"file:..\/core\",<br \/>\n        \"bluetooth\": \"file:..\/bluetooth\"<br \/>\n...<br \/>\n<\/code><\/p><\/blockquote>\n<\/li>\n<li>Restart the server to build it.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>This is out-of-date. Just follow the instructions at https:\/\/github.com\/Microsoft\/pxt-microbit I&#8217;ve been looking into the Micro:Bit and Microsoft&#8217;s PXT (Programmer eXperience Toolkit). PXT and all the required build tools can be installed on macOS, but the official instructions are a little weak. Here are the required steps: Installation \/ Running All these commands need to be &hellip; <a href=\"https:\/\/siever.info\/home\/pxt-for-the-microbit-locally-on-macos\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">PXT for the Micro:Bit locally on macOS<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-916","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/siever.info\/home\/wp-json\/wp\/v2\/posts\/916"}],"collection":[{"href":"https:\/\/siever.info\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/siever.info\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/siever.info\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/siever.info\/home\/wp-json\/wp\/v2\/comments?post=916"}],"version-history":[{"count":5,"href":"https:\/\/siever.info\/home\/wp-json\/wp\/v2\/posts\/916\/revisions"}],"predecessor-version":[{"id":1835,"href":"https:\/\/siever.info\/home\/wp-json\/wp\/v2\/posts\/916\/revisions\/1835"}],"wp:attachment":[{"href":"https:\/\/siever.info\/home\/wp-json\/wp\/v2\/media?parent=916"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/siever.info\/home\/wp-json\/wp\/v2\/categories?post=916"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/siever.info\/home\/wp-json\/wp\/v2\/tags?post=916"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}