Anicon - Animal Complex - Cat's Path Mac OS
JavaScript packaged by npm for the win!
- Different editions
- Verify Install
- Node Versions Installed
- NVM
- Install node and .npm-packages without npm
- Install Node packages
- Code Node JavaScript
- Bower Install of GUI apps
- Node modules
Clena, your normal everyday girl, finds herself in front of a circus filled with lovely animals. However, she quickly discovers. Kotlin Programming By Example Iyanu Adelekan download Z-Library. Download books for free. Anicon - Animal Complex - Cat's Path. South Park is an American animated sitcom created by Trey Parker and Matt Stone and developed by Brian Graden for Comedy Central.The series revolves around four boys—Stan Marsh, Kyle Broflovski, Eric Cartman, and Kenny McCormick—and their exploits in and around the titular Colorado town. Download Spellstone. Spellstone is a fantasy card game with beautiful hand-drawn art and rich lore! Collect hundreds of striking cards to battle through a compelling story to unravel the mystery of.
The objective of this tutorial is to spare you the pain and confusionaround installing, updating, and uninstalling the various editions and versions of Node (aka NodeJs, with Js for JavaScript).
Why Node?
Popularity is manifested in the number of new modules being contributed.And Node is fast. It’s portable. What’s not to like?
Different editions
Installing Node has become complex due to the drama behinddifferent editions and versions of Node withdifferent mechanisms for managing updates,each with permissions issues.
For these reasons, many instructions on the internet are outdated, contradictory, or plain wrong.
Node.js was started as an open-source project in 2009 byRyan Dahl.Its second contributor was Isaac Schlueter who now leads the project.The project had a total of 447 core contributors as of 2016. Dahl was employed by Joyent.comduring much of Node’s development, and Joyent continues to sponsor Node. Joyent has raised in the neighborhood of $100 million in venture capital and has an employee headcount in excess of 120.Joyent as a cloud computing company was purchased in 2015 by Samsung (Korea).
Long Term Support
Long Term Support releases, introduced Fall, 2015, are actively developed for 18 months,then maintained for a further 12 months. This means a particular LTS release stays in production for 30 monthswith bug and security fixes.
PROTIP: Odd numbered versions are not destined for active status, unstable development versions.
There are two versions active at the same time.
N Solid
N Solid from NodeSource is a “fully compatible Node.js runtime enhanced to address the needs of enterprise production support.”
Their disto provides a GUI and a way to pull telemetry for V8 process monitoring.
Again, this is a licensed product. I’ve heard that they provide support at $1,000 per developer per month ($12,000 per year).
StrongLoop to IBM
A VentureBeat article in 2013 writes “Two programmers named Ben Noordhuis and Bert Belder have founded a new company called StrongLoop. And they’re apparently attempting to hijack the Node brand and community for themselves.”Strongloop supports Express and LoopBack frameworks.On 10 Sep 2015, StrongLoop was acquired as IBM API Connect, which focuses on the API lifecycle.
io.js is gone
In 2013 iojs.org, a fork of Node.js was formed by several core committers frustrated by Joyant.
Then on September, 2015, io.js merged with the Node.js project againunder new nodejs.org/en/foundation governance.
Which version of what?
QUESTION: What are the install instructions If you’re an enterprise user paying for LTS?
Instead of using an internet browser to download an installer from
https://nodejs.org/en/download/releases/
consider these:
nvm (node version manager) is a shell function that downloads and upgrades versions of node.js. It’s not needed unless you want to keep and upgrade multiple versions of Node.js. But you will eventually will need to.
npm (node package manager) installs JavasSript packages such as Express.js.
Ideally, we would have both nvm and npm on the same machine, each configured the way we want for maximum productivity.
However, there is a conflict between the ideal way of installing npm with how nvm works.
The ideal way to install most applications is to NOT need to use the sudo prefix command to temporarily elevate permissions.
On a Mac, by default, npm is installed in the .npm folder.
To make it work, we install it in the .npm-packages folder by placing a configuration setting.
However, nvm does not recognize that configuration setting and thus only works with plugins installed in the default .npm folder.
Yes, why can’t people from nvm and npm get together and work things out?
Thus, a choice needs to be made.
Choose among alternatives
Click on one of the mutually exclusivevariations of installing Node foradditional information and instructions:
A: Brew install node WITHOUT npm, then install .npm-packages with no nvm.
This is what I recommend after hassling with yarn installation.
B: “N” from github.com/tj/n
“Node.js version management: no subshells, no profile setup, no convoluted API, just simple.”
http://theholmesoffice.com/node-js-fundamentals-how-to-upgrade-the-node-js-version/
C: Install NVM, then install Node using NVM.
Installing Node automatically installs NPM.
- https://docs.npmjs.com/getting-started/fixing-npm-permissions
- https://docs.npmjs.com/getting-started/fixing-npm-permissions
D: Download LTS (Long Term Support) v4.x from NodeJs website and run the installer manually.
E: Download latest version v6.x from NodeJs website and run the installer manually.
F: Download latest version of N Solid.
CAUTION: Even though pricing for NodeSource is NOT published on the website doesn’t mean it’s free. I’ve heard pricing for both Joyant and NodeSource start at around $1,000 per month per developer.
Verify Install
These instructions are used when both verifying a new setup and when obtaining facts when troubleshooting an established setup.
Return here after installation.
PROTIP: Before you speak to someone about this, provide them your operating system facts, obtained using instructions here:
Operating system information:
uname -a
On my machine, the response:
Obtain node version:
node -v
At time of writing, the response for the most recent version:
Obtain npm version:
npm -v
At time of writing, the response (for the Node version obtained above):
Verify:
echo $NODE_PATH
The response if installed by NVM or by downloaded installer:
The response if installed using brew:
Regardless of how you installed node,before discussing your installation, obtain and present the facts above.
From any folder, for just a simple list of package names:
ls `npm root -g`
PROTIP: npm itself is a Node package.
Alternately, list global npm packages installed as a tree:
npm list -g --depth=0
The response is a list with version numbers:
Note the first line in the response shows the folder.
List what modules are installed in the traditional location for Node:
ls /usr/local/lib/node_modules
- bower
- firebase-tools
- generator-karma
- grunt
- grunt-cli
- http-server
- gatsby
- iothub-explorer
- mocha
- yo
- traceur
- serverless
- npm
QUESTION: When Node is installed using Homebrew,same location?
Does node REPL work?
Initialize the Node command-line:
node
The response is simply a
>
character.Type this command:
console.log(‘Node is running’);
The response should reflect what is in the command.
From inside REPL, get a list of commands (with a leading dot):
.help
PROTIP: Node interactive commands begin with a dot.
The response:
To get out gracefully:
.exit
Alternately, you can (crudely) press control+C to abort the process.
Node Versions Installed
Traditionally, NVM (Node Version Manager) installs multiple versions of Node.
List what versions of Node are installed:
nvm ls
Sample response:
PROTIP: Most don’t need multiple versions of Node at once.
PROTIP: Using NVM conflicts with Homebrew.Since many prefer to use Homebrew for everything else,it’s annoying to remember such exceptions.
NPM Packages
The installer of Node also installs NPM (Node Package Manager)which manages installation of Node packages.
List what versions of NPM are available for install from the internet:
nvm ls-remote
At time of this writing, there were 376 versions.
List what modules are available for install from the internet:
nvm
List files in the traditional location when NPM installs Node packages:
ls ~/.npm
Also:
ls /usr/local/lib/node_modules/npm/node_modules
On Windows:
Examples:
- semver
- xml
- y18n
NVM
NVM (Node Version Manager) downloads and installs multiple versions of Node.js,then enables using a specific version of Node,using a command such as this (after installation and cd to your node app folder):
nvm run 4.5.0 app.js
The above is for the LTS (Long Term Support) version.
If instead you want to run the latest versions of Node:
PROTIP: Remember that there is no “v” to specify a version, unlike the install command:
nvm install v4.5.0
To do the above, you first have to install NVM and Node, described in the steps below.
NVM Install
Installation steps:
PROTIP: Use an iternet browser to read the README.md at https://github.com/creationix/nvm
Note the version of installer:
If you’ve installed another way before,make sure that if you have an ~/.npmrc file, it does not contain any prefix settings (which is not compatible with nvm):
atom ~/.npmrc
An example:
PROTIP: This file is used by “Option A” above, thus the mutually exclusive options.
Install C++ Compiler.
NVM uses a C++ compiler installedwith Apple’s stand-alone Command Line Tools also within Apple’s XCode application.
The README at https://github.com/creationix/nvm notes that it uses a C++ compiler installedwith Apple’s stand-alone Command Line Tools also within Apple’s XCode application.
Agree to Apple’s license:
sudo xcodebuild -license
Type in your root password, hold down Enter until it stops, then type agree and Enter.
Install NVM using wget:
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.31.6/install.sh bash
PROTIP: The instructions say either curl or wget, but I prefer using wget because it is not installed by default,and nvm requires it. So if you don’t have wget, better to know it sooner than later.
The command installs to hidden folder
~/.nvm
andlooks into the~/.bashrc
file used by Linux machines.More on this soon.The response:
If you see this instead:
CAUTION: NVM does not recognize the PREFIX used in the Alternate folder technique.So we would need to live with just elevated permissions.
What the above does is equivalent to:
cd ~
git clone http://github.com/creationix/nvm.git .nvmSo the command above is what some recommend to fix issues with nvm install.
Verify:
nvm --version
If you get a version code such as the below (25 August 2016), proceed to use NVM.
TROUBLESHOOTING: If instead of the version code, this message appears:
Edit the file that Mac uses to initiate Terminal,using atom or other editor (vi, nano, etc.)
subl ~/.bash_profile
Add to the bottom of the file:
## Export the NVM path and run its shell:
export NVM_DIR=”$HOME/.nvm”
[ -s “$NVM_DIR/nvm.sh” ] && . “$NVM_DIR/nvm.sh” # This loads nvmRestart Terminal so it takes:
source ~/.bash_profile
To verify that nvm has been installed:
command -v nvm
NOTE: nvm is a shell script, not an executable, so the usualy
where
command does not work.The response should be:
To verify that nvm has been installed:
echo $NVM_DIR
The response should be (where “mac” is substituted with your own user id):
For a list of commands, type nvm by itself:
nvm
PROTIP: Widen the screen to avoid text wrapping.
Upgrade NVM
To download, compile, and install the latest v5.0.x release of node:
nvm install
The response:
Use NVM to install Node
To list what versions of Node.js are installed:
nvm ls
The response is like this:
Available to install
To list what versions of Node.js are available to install:
nvm ls-remote
Scroll to “(Latest LTS: Argon)”, such as:
It’s installed by these instructions.
The latest version is at the bottom of the list, such as:
Clear NPM Cache
Install latest version
Install the latest version of Node.js:
nvm install node
The response:
Notice that there is specific version of npm to support each version of Node.
TROUBLESHOOTING:If these message also appear:
As this advises,get rid of those messages on the Mac by going to Terminal > Preferences > Advanced tabto uncheck “Set locale environment variables on startup”:
Exit Terminal to activate it or you’ll see the message again.
Uninstall Node version
Installing does not automatically uninstall previous versions.
To uninstall a version:
nvm uninstall v6.4.0
The response:
Install the most recent LTS version of Node according to nvm ls-remote:
nvm install v4.5.0
Verify install.
Install node and .npm-packages without npm
Ths recommended byAdvice on fixing npm On Mac OS X for Homebrew Users
Uninstall default Brew install
If node was previously installed, uninstall it:
No damage is done if this command is run even though brew is already uninstalled.
If node was previously installed,these folders have been known to block re-install,so remove them by using the code below:
Supply your password when prompted.
Remove locations where Node can be installed:
Create .npm-packages folder
Create the ~/.npm-packages folder:
mkdir “${HOME}/.npm-packages”
To avoid permission issues:
Provide your password when prompted.
Indicate to npm where to store globally installed packagesby adding a line at the bottom of the ~/.npmrc file:
echo prefix=~/.npm-packages » ~/.npmrc
WARNING: NVM does not support this, which is OK since we are doing this to get awayfrom using it anyway.
Confirm:
cat ~/.npmrc
Install node without default NPM:
brew install node --without-npm -g
Alternately, install npm for global use:
The response:
If you also get this message:
Define NODE_PATH
Edit the ~/.bash_profile to insert these lines:
BTW, ~/.bash_profile on Mac is equivalent to the .bashrc file used in Linux systems.
To ensure npm will find installed binaries and man pages,add a NPM_PACKAGES environment variable containing the path to npm-installed packagesinto the system PATH variable:
Use of
${HOME}
makes the path more generic and less complicatedthan having to substitute your user name such as “mac”:Save the file and make sure the changes run fine:
source ~/.bash_profile
Make sure that the Mac’s executable search PATH contains the node executable is in the PATH:
echo $PATH
If not add it to the system PATH:
Verify Node Version
After install,
verify whether the node program works:
node --version
The response should be its version, such as:
To identify where node executables are installed:
which node
the response:
See that Node is one among many other programs at:
ls /usr/local/bin grep node
BTW, an alternative to NVM is “N” from https://github.com/tj/n.However, I never got it to work for me.
Brew standard install
If you have already followed instructions at my Homebrew installation tutorialto install Homebrew:
Click here if you want to go straight to the recommended option B.
WARNING: Homebrew installs Node to a different location than other ways.
Be aware of your present current directory:
pwd
CAUTION: Without specifying the
-g
in the next command, installation is whatever is the current folder.Install node globally using Homebrew:
brew install node -g
The initial response at time of writing (August 2017):
PROTIP: Homebrew downloads installers to
~/Library/Caches/Homebrew/
and looks for installers there to avoid downloading again.PROTIP: Notice the bottle is specific to the version on your operating system(such as “sierra”).
You should now see something like this:
If you get this error message between the two messages above:
Run the command.
If you get this error message between the two messages above:
Following the advice above:
brew link node
If you see this:
NOTE: By default, when node is installed, it installsnpm, the Node Package Manager,a node package to install additional packages.
Identify which folder npm is obtained:
which npm
The response for default installations:
Alternatively:
List npm global modules installed on the default global module folder:
ls /usr/local/lib/node_modules
The response contains npm plusfirebase-tools, http-server, gatsby, iothub-explorer, serverless
C: Download and Install Manually
- Download installer from http://nodejs.org
- Use the Mac Finder to navigate to the file in your Downloads folder.
- Unzip the file downloaded.
- Execute the file.
- Respond to the prompts.
- Skip to Verify the install
Install Node packages
The current global location:
npm config get prefix
The answer (where “mac” is substituted with your user name):
See https://www.sitepoint.com/beginners-guide-node-package-managerabout global vs. local package install.
The command to install a package without additional parameters is, for example:
pwd
npm install serverless
This installs the node packages locally within whatever folder is the present working directory, revealed by the pwd
command.
However, we usually need node packages to be installed globally for access from any present directory by any user on the machine.
This location is one MacOS requires sudo (super user do) permission elevation. For example:
sudo npm install serverless -g
Without sudo, an error would occur from the above command such as:
This is because the default npm folder is managed at the system level, not user level.
To avoid these permission issues, some recommend higher permissions to folders, as in:
sudo chown -R $USER:$GROUP ~/.npm
sudo chown -R $USER:$GROUP ~/.config
This may not be enough to address installation issues when using Homebrew such as when upgrading with command:
npm update npm -g
Alternate folder
We can install the folder under a user’s HOME folder, which is defined by the ${HOME} environment variable:
echo “${HOME}”
The alternative npm folder name established by convention is:
ls ~/.npm-packages
To achieve this, we first need to uninstall the default install:
rm -rf /usr/local/lib/node_modules
brew uninstall node
All of Node needs to be uninstalled because it installed npm which uses the system folder.
To install node for global use, we can invoke
Code Node JavaScript
To enable publication on NPM and Bower,packages such as Datatables containextensions and styling options in well defined CommonJS and AMD loaders.This also opens options to use other tools such as Browserify and WebJars.
Others who have blogged about this include:
- http://quickleft.com/blog/getting-started-with-express-in-node
Make a folder containing Node application files, and go to it:
Install the express package and its dependencies:
npm install express -g
Use a text editor to create file
index.js
containing “Hello World” code in JavaScript:NOTE: Semicolons and carriage returns serve the same purpose in JavaScript. You only need semicolons if you are concatenating code together in a single line.
See https://www.airpair.com/javascript/posts/eleven-mistakes-developers-javascript
Start the Node server running the default index.js program:
node index.js
The window remains open and accept no other commandsuntil you press control+C to escape the process.
Switch to an internet browser to open the Node Express web server running locally at port 3000:
If you get “TypeError: res.json is not a function” …
Nodemon
See https://github.com/remy/nodemon
Install NodeMon:
npm install nodemon -g # -g installs globally as system command.
nodemon index.js # watch for changes and kill server when neededRestart your node server specified in a coffee-script:
nodemon server.coffee
Bower Install of GUI apps
Bower is similar to NPM, but for front-end GUI applications.
Any frameworks or 3rd-party libraries that need to be accessible in the user’s browserwill be managed by bower.
Similarly to NPM, bower tracks dependencies in a file called bower.json.
Install bower globally via npm:
npm install -g bower
Running bower install will resolve, download, and install them.
Project Bower Install
cd to the project’s folder.
Install the project’s bower components using bower:
bower install
Install http-server using npm:
npm install -g http-server
Fire up the server at default port 8080:
http-server client/
npm ls
http-server client/
Node modules
A module is a single JavaScript file.
A package is a directory containing modules.
A list of shorthands for the NPM command
https://docs.npmjs.com/misc/config
Famous Node modules are listed below.
Yarn Install
An alternative to NPM is yarn, which uses Node to generate software.
Yarn is used by https://github.com/dancancro/great-big-example-application
To install it on a machine with NPM already installed:
Install using Homebrew:
brew install yarn --ignore-dependencies -g
The response:
PROTIP: Using Brew means that you don’t need to setup path yourself.
BTW, A search of all files that mention “yarn” yielded this list:
Verify that Yarn is installed by running:
yarn --version
At time of writing in 2017, the version was:
There is a more precise version:
ls /usr/local/Cellar/yarn
At time of writing in 2017, the output was:
Verify the yarn command works:
yarn
At time of writing in 2017, the response was:
Grunt
npm install -g grunt-cli
The response:
Gulp
LearnNode Programming Tutorial
The classic interactive tutorial introducing Node.Js was created on:
To install it we reference its npm package on npm.org:
Run
npm install learnyounode -g
Notice the -g can go before or after the module being installed.
Run
learnyounode
NOTE: Use keyboard up/down arrows to select option. This is not a GUI interface.
The tutorial consumes a Terminal window process.
To exit, press control/command + C to close the process.
When you’re done, run
npm uninstall learnyounode
.
How NPM works
HEADS UP! This article was written for an older version of node. More up-to-date information may be available elsewhere.https://howtonode.org/introduction-to-npm
http://stackoverflow.com/questions/25897908/how-npm-install-works
https://www.npmjs.org/doc/cli/npm-shrinkwrap.html
I use Node.js (via browserify) for each of my web apps, all of which have some dependencies in common and others specific to themselves. Each of these apps has a package.json file that specifies which versions of which modules it needs.
Yes, that is what npm install does. In node.js code, the require algorithm has a particular sequence of places it looks, including walking up the filesystem. However, npm install doesn’t do that. It just installs in place. The algorithms it uses are all constrained to just a single node_modules directory under your current directory and it won’t touch anything above that (except for with -g).
Right now, I have a /node_modules directory in the parent folder of my apps for modules that they all need to reference, and then I put app-specific modules in a node_modules folder in that app’s directory. This works fine in the short term, since my require() statements are able to keep looking upward in the file structure until they find the node_modules directory with the correct app in it.
Where this gets tricky is when I want to go back to an old project and run npm install to make sure it can still find all the dependencies it needs. (Who knows what funny-business has occurred since then at the parent directory level.) I was under the impression that npm install did this:
When I run npm install inside an app folder, however, it appears to install everything locally regardless of where else it may exist upstream. Is that the correct behavior? (It’s possible there’s another reason, like bad version language in my package.json). If this IS the correct behavior, is there a way for me to have npm install behave like the above?
It’s not a big deal to widely replicate the modules inside every app, but it feels messy and prevents me from make small improvements to the common modules and not having to update every old package.json file. Of course, this could be a good thing…
Yeah basically you’re doing it wrong. The regular workflow scales well to the Internet. For your use case it creates some extra tedious work, but you can also just use semantic versioning as intended and specify “mylib”: “^1.0.0” in your package.json for your apps and be OK with automatically getting newer versions next time you npm install.
If installed using homebrew so it’s done on every shell session:Add to ~/.profile
Additional topics
source $(brew –prefix nvm)/nvm.sh
Resources
Several blogs addresses issues related to this topic:
- https://docs.npmjs.com/getting-started/fixing-npm-permissions
- Install npm packages globally without sudo on OS X and Linux
- http://stackoverflow.com/questions/16151018/npm-throws-error-without-sudo/24404451#24404451
- http://stackoverflow.com/questions/10081293/install-npm-into-home-directory-with-distribution-nodejs-package-ubuntu/13021677#13021677
https://github.com/isaacs/nave nave is a virtual environment for node, an alternative to nvm. It is invoked by source command rather than run.
http://blog.teamtreehouse.com/install-node-js-npm-mac
https://github.com/felixrieseberg/npm-windows-upgrade enables upgrade of Node on Windows using elevated PowerShell scripts.
http://www.backdrifter.com/2011/02/18/using-nvm-and-npm-to-manage-node-js from 2011 is frequently quoted.
- Building Web Applications with Node.js and Express 4.0 (UPDATE)released 23 Mar 2018 by Jonathan Mills
More on MacOS
This is one of a series on MacOS:
Please enable JavaScript to view the comments powered by Disqus.This page contains instructions for verifying that Telegram's open source code is exactly the same as the code that is used to build the apps that are available in the App Store, Google Play and directly on the Telegram website.
Warning: Telegram supports reproducible builds as of version 5.13. Bear in mind that, at this stage, the verification process should be considered experimental. We will be updating our apps and these instructions to make this process as straightforward as possible.
Please read the relevant notes and troubleshooting section carefully.
Anicon - Animal Complex - Cat's Path Mac Os X
Reproducible Builds for Android
Step 1. Install Docker
Docker can be obtained here. Once the installation is complete, log into your Docker account > Preferences > Advanced and configure the amount of resources Docker may use:
Docker Performance
We recommend using the maximum amount allowed by your system's hardware, in order to speed up the build time.
Step 2. Confirm which version you have installed on your Android device
You can find the version/build number at the bottom of the Settings page. Note that Telegram supports reproducible builds starting with version 5.13.
The commit tag to checkout source code for the example above will be release-5.13.0_1821
.
Please make sure that you're using the correct version and build number of the version you want to check (and not the one from this example ).
The part after the version number will help you know in which folder to look for the correct APK when you've finished building the app (Step 4):
- “Direct” after version number means that the APK will be inside the “afat/standalone” folder.
- “Universal” after version number means that the APK will be inside the “afat/release” folder.
- If you have Android Version 6.0 or greater, your APK folder will have the “_SDK23” suffix.
- “arm64-v8a” - folder name will start with “arm64”.
- “armeabi-v7” - folder name will start with “armv7”.
- “x86” - folder name will start with “x86”.
- “x86_64” - folder name will start with “x64”.
APK Folders
Step 3. Obtain the source code
Open Terminal, run the commands:git clone https://github.com/DrKLO/Telegram.git $HOME/telegram-android
cd $HOME/telegram-android
git checkout release-{VERSION AND BUILD NUMBER FROM STEP 2}
For our example, the command would be:git checkout release-5.13.0_1821
Step 4. Build the app
Open Terminal, run the commands:cd $HOME/telegram-android
docker build -t telegram-build .
docker run --rm -v '$PWD':/home/source telegram-build
These commands will produce 9 different APKs for different target SDK versions and CPU ABIs.
These APKs can be found in:$HOME/telegram-android/TMessagesProj/build/outputs/apk/
Use the folder name from Step 2 to find the correct folder that holds the same APK as installed on your device. For example, for non-universal Android 9.0 arm64-v8a, the path to your APK will be:$HOME/telegram-android/TMessagesProj/build/outputs/apk/arm64_SDK23/release/app.apk
Copy this APK to the root source directory by running this command in Terminal:cp $HOME/telegram-android/TMessagesProj/build/outputs/apk/arm64_SDK23/release/app.apk $HOME/telegram-android/telegram_built.apk
Anicon - Animal Complex - Cat's Path Mac Os 11
Step 5. The Telegram APK installed on your device
Anicon - Animal Complex - Cat's Path Mac Os Download
You will need adb for this step.
If you downloaded your APK directly from Telegram's website, use the package name org.telegram.messenger.web
in this step. To verify the Google Play APK, use org.telegram.messenger
.
Connect your device to the computer, open Terminal, run the commands:adb shell pm path org.telegram.messenger
The output will look something like this:package:/data/app/org.telegram.messenger-_zOSURFEx2GpHM8UDF_PVg/base.apk
By using this information, pull the APK from your device to $HOME/telegram-android using command:adb pull /data/app/org.telegram.messenger-_zOSURFEx2GpHM8UDF_PVg/base.apk $HOME/telegram-android/telegram_store.apk
Step 6. Compare the APKs
Open Terminal, run the commands:cd $HOME/telegram-android
python apkdiff.py telegram_store.apk telegram_built.apk
If the APKs are the same, you will seeAPKs are the same!
If your APKs don't match, please make sure that you chose the correct code version and the right SDK.
Check out the Troubleshooting section first in case you run into trouble.
Reproducible Builds for iOS
The verification process for iOS builds is, unfortunately, a lot more complex than for Android. The two main issues with Apple's current policies and infrastructure are as follows:
Apple insists on using FairPlay encryption to “protect” even free apps from “app pirates” which makes obtaining the executable code of apps impossible without a jailbroken device. To solve this issue, Apple would simply need to allow submitting unencryptable binaries to the App Store. This would not affect security since the code would still be signed – and would enable anyone to check the integrity of apps supporting reproducible builds without endangering the integrity and security of their devices.
Building your own reproducible binaries is difficult because macOS doesn't support containers like Docker. If Apple followed in the footsteps of Linux (and even Microsoft!) and added container support, it would eliminate the need for steps 1-3 in the guide below.
As things stand now, you'll need a jailbroken device, at least 1,5 hours and approximately 90GB of free space to properly set up a virtual machine for the verification process.
To provide a stable and easily reproducible environment, Telegram iOS builds are compiled on a virtual machine. Parallels is used to verify the builds.
Step 1. Install the Parallels virtual machine
Parallels can be obtained here, it features a fully-functional trial version.
Step 2. Install the latest version of macOS Catalina
To download an image that can be installed on the virtual machine, open the App Store, search for “Catalina” and click “View”.
macOS Catalina > Get
This will open a system pop-up offering to download the OS:
Choose “Download” and wait for the download to finish.> If you were not using the latest version of the OS, your system may start updating instead. Please finish updating to download macOS Catalina.When done, open Parallels and choose macOS Catalina:Anicon - Animal Complex - Cat's Path Mac Os Download
Select 'Install Windows or another OS' > Continue
Select a file... > Applications (All files) > Install macOS Сatalina
Before starting the installation, configure the virtual machine:
Change the name of the virtual machine to macos10_15_Xcode12_2
Name VM as macos10_15_Xcode12_2
Hardware > Processors: 2-4
Memory > 4GB may suffice but 8GB is recommended
You will get something like this:
Click Continue
Parallels may request access to your microphone and camera, this is not required – just press Close.
Your Apple ID is also not required, you can choose Set Up Later.
Skip Apple ID with 'Set Up Later'
Use “telegram” for both the account name and password.
Do not ever use the password “telegram” for anything else, it's cursed.
Create a computer account with 'telegram' set both as account name and password
Now install Parallels tools from the menu bar:
Install Parallels Tools using menu bar > Parallels icon > Actions > Install (Reinstall) Parallels Tools...
After the system restarts, log in.
Open Terminal and run:sudo visudo
Enter the password “telegram”
Find this line at the end of the file:%admin ALL=(ALL) ALL
Press “i” on your keyboard, add “NOPASSWD:”%admin ALL=(ALL) NOPASSWD: ALL
Press Escape.
Type in “:wq”
Press Enter
Press i to edit the highlighted string.
Enter :wq > press Enter.
In the terminal, run:sudo systemsetup -setcomputersleep Never
sudo systemsetup -setcomputersleep Never > press Enter.
Step 3. Install SSH keys on the virtual machine
In the virtual machine, open System Settings > Sharing and enable Remote Login.
In the virtual machine, open Terminal and run:mkdir -p .ssh; nano .ssh/authorized_keys
In your main OS, open Terminal and run:if [ ! -e ~/.ssh/id_rsa.pub ]; then ssh-keygen -t rsa -b 4096; fi && cat ~/.ssh/id_rsa.pub pbcopy
If you see the line “Enter file in which to save the key (/Users/…/.ssh/id_rsa):”, press Enter
In the virtual machine, press CMD+V
Then Ctrl+O, Ctrl+X
Step 4. Install Xcode version 12.2
In the virtual machine, open Safari and go to https://developer.apple.com
Sign in to your Account:
developer.apple.com > Account > sign in with your Apple ID
Go to Downloads > More
Enter Xcode in the search field and find the version 12.2
Once the installation is complete, open the file Xcode 12.2.xip. The system will unarchive the app into the same folder. Move it to the Applications folder using Finder.
Unarchive Xcode > drag the app to Applications folder
On the virtual machine, run this command from the terminal:sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
Shut down the virtual machine.
Step 5. Obtaining the source code
git clone --recursive https://github.com/TelegramMessenger/telegram-ios.git $HOME/telegram-ios
cd $HOME/telegram-ios
git checkout release-${VERSION_NUMBER}
E.g., git checkout release-7.3
. Please note that you need to check out the whole git history as the build version depends on the number of commits in the repository.
Step 6. Downloading Bazel 3.7.0 to $HOME/bazel/bazel
mkdir -p $HOME/bazel && cd $HOME/bazel
curl -O -L https://github.com/bazelbuild/bazel/releases/download/3.7.0/bazel-3.7.0-darwin-x86_64
mv bazel-3.7.0-darwin-x86_64 bazel
Check that you have downloaded the correct version:chmod +x bazel
./bazel --version
Step 7. Building the app
Open Terminal, run the commands:cd $HOME/telegram-iosBAZEL='$HOME/bazel/bazel' sh buildbox/build-telegram.sh verify
If the environment has been set up correctly, this will start the building process. Note that this step can easily take 30-40 minutes. The average build time on a MacBook Pro (i9 6 core) is 35 minutes.
Once the process is complete the resulting IPA file can be found in build/artifacts/Telegram.ipa
All the following steps will be made via Terminal on your main system.
Step 8. Downloading a decrypted version of the app from the App Store
This step requires a jailbroken device equipped with tools for decrypting apps. We‘d love to make this process more simple but that’s what you get for using Apple tech.
Step 9. Comparing the AppStore build and the version built in the virtual machine
Install the necessary tools:if ! type brew > /dev/null; then /usr/bin/ruby -e '$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)'; fi && brew install python3
Runpython3 tools/ipadiff.py build/artifacts/Telegram.ipa PATH-TO-THE-IPA-FILE-FROM-STEP-9
- cd telegram-ios > Enter
- python3 tools/ipadiff.py build/artifacts/Telegram.ipa /path/ > Enter
In case of a successful comparison, you will get a text along these lines:
In case of any mismatches, you'll get a detailed report.
iOS: Notes
You will get a warning if the archive created in Step 7 contains encrypted files. If all these files are in the
PlugIns
subfolder, they represent various system extensions (e.g. external sharing, Siri, 3D touch). Decrypting such files using existing ways of receiving app archives via Jailbreak is non-trivial (but we're working on resolving this issue). If you do manage to decrypt them, e.g. on iOS 8, they will be matched.You will be notified if the archive includes an Apple Watch app. The watch app will soon no longer be included in the archive.
Files with the
.car
extension are app resource archives (images, sounds) which were compiled and processed specifically for the target device. The App Store processes them in non-trivial ways, we're planning on getting rid of them in future versions.The
LaunchScreen.nib
file is an empty file containing a description of the interface which is displayed by the system before the app is launched. It is processed by the App Store in a non-trivial way but doesn't contain any code and therefore may be ignored.
Troubleshooting
If you encounter any issues with obtaining the code, building and comparing the apps, please contact us at @botsupport and include the hashtag #reproducibleBuilds
with your message describing the problem.
Troubleshooting: Android
Make sure that you checkout the correct version of the code.
Make sure that you build the app using the right SDK.
If the gradle version used in the Dockerfile is not available anymore and building of the Docker image fails, wait for a Dockerfile update or update manually to lastest available version.
…
We will update this section with information on overcoming other common issues.