<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>nim programming language Archives - Linux Windows and android Tutorials</title>
	<atom:link href="https://www.osradar.com/tag/nim-programming-language/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.osradar.com</link>
	<description>tutorials and news and Seurity</description>
	<lastBuildDate>Tue, 24 Nov 2020 20:19:29 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8.12</generator>
	<item>
		<title>Install Nim programming language on Ubuntu 20.04 / Debian 10</title>
		<link>https://www.osradar.com/nim-programming-language-ubuntu-debian/</link>
					<comments>https://www.osradar.com/nim-programming-language-ubuntu-debian/#respond</comments>
		
		<dc:creator><![CDATA[angeloma]]></dc:creator>
		<pubDate>Wed, 25 Nov 2020 00:10:00 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[nim]]></category>
		<category><![CDATA[nim programming language]]></category>
		<category><![CDATA[Programming language]]></category>
		<category><![CDATA[Tutorial]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=19682</guid>

					<description><![CDATA[<p>Nowadays, almost everything is done with the help of a computer and a program. And the programs are made through a programming language. That is why it must be efficient languages with new technical features that can be brought to the program and the end-user. Today we will teach you how to install Nim programming [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/nim-programming-language-ubuntu-debian/">Install Nim programming language on Ubuntu 20.04 / Debian 10</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Nowadays, almost everything is done with the help of a computer and a program. And the programs are made through a programming language. That is why it must be efficient languages with new technical features that can be brought to the program and the end-user. <strong>Today we will teach you how to install Nim programming language on Ubuntu 20.04 / Debian 10. </strong></p>



<p>To quote the <a href="https://nim-lang.org/" target="_blank" rel="noreferrer noopener" aria-label="website of this programming language (opens in a new tab)">website of this programming language</a>:</p>



<blockquote class="wp-block-quote"><p>Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada, and Modula.</p></blockquote>



<p>This gives us a pretty good idea that the language meets everything needed to create modern applications. </p>



<p>Like all modern languages, it has versions for <a href="https://www.osradar.com/tag/windows" target="_blank" rel="noreferrer noopener" aria-label="Windows (opens in a new tab)">Windows</a>, Linux, macOS, and BSD. This makes it possible to run on almost all current systems. This also makes it possible for the programmer to choose the environment where he feels best.</p>



<p>Nim is an object-oriented language with a syntax similar to <a rel="noreferrer noopener" aria-label="Python (opens in a new tab)" href="https://www.osradar.com/tag/python" target="_blank">Python</a>&#8216;s with even similar characteristics.</p>



<p>So, let us get to work.</p>



<h2>Installing Nim programming language on Ubuntu 20.04 / Debian 10</h2>



<p>In Ubuntu 20.04 / Debian 10 Nim is included in the official repositories. Therefore the installation becomes quite simple and is summarized too in</p>



<pre class="wp-block-preformatted">:~$ sudo apt install nim</pre>



<p><strong>However, this method is not recommended because the latest Nim version is not installed. </strong></p>



<p>So there is another method that allows us to install the latest stable version, but also the development version.</p>



<p>To install it, there is a script that we have to download and run but first, we have to install the Debian compilation packages.</p>



<p>So, open a terminal and execute the following command</p>



<pre class="wp-block-preformatted">:~$ sudo apt install build-essential
Reading package lists… Done
 Building dependency tree       
 Reading state information… Done
 The following additional packages will be installed:
   binutils binutils-common binutils-x86-64-linux-gnu cpp cpp-8 dpkg-dev fakeroot g++ g++-8 gcc gcc-8 libalgorithm-diff-perl libalgorithm-diff-xs-perl
   libalgorithm-merge-perl libasan5 libatomic1 libbinutils libc-dev-bin libc6-dev libcc1-0 libdpkg-perl libfakeroot libfile-fcntllock-perl libgcc-8-dev libgomp1
   libisl19 libitm1 liblsan0 libmpc3 libmpfr6 libmpx2 libquadmath0 libstdc++-8-dev libtsan0 libubsan1 linux-libc-dev make manpages-dev patch
 Suggested packages:
   binutils-doc cpp-doc gcc-8-locales debian-keyring g++-multilib g++-8-multilib gcc-8-doc libstdc++6-8-dbg gcc-multilib autoconf automake libtool flex bison gdb
   gcc-doc gcc-8-multilib libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan5-dbg liblsan0-dbg libtsan0-dbg libubsan1-dbg libmpx2-dbg libquadmath0-dbg
   glibc-doc git bzr libstdc++-8-doc make-doc ed diffutils-doc
 The following NEW packages will be installed:
   binutils binutils-common binutils-x86-64-linux-gnu build-essential cpp cpp-8 dpkg-dev fakeroot g++ g++-8 gcc gcc-8 libalgorithm-diff-perl libalgorithm-diff-xs-perl
   libalgorithm-merge-perl libasan5 libatomic1 libbinutils libc-dev-bin libc6-dev libcc1-0 libdpkg-perl libfakeroot libfile-fcntllock-perl libgcc-8-dev libgomp1
   libisl19 libitm1 liblsan0 libmpc3 libmpfr6 libmpx2 libquadmath0 libstdc++-8-dev libtsan0 libubsan1 linux-libc-dev make manpages-dev patch
 0 upgraded, 40 newly installed, 0 to remove and 54 not upgraded.
 Need to get 49.4 MB of archives.
 After this operation, 185 MB of additional disk space will be used.
 Do you want to continue? [Y/n]</pre>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="286" src="https://www.osradar.com/wp-content/uploads/2020/04/1-7-1024x286.png" alt="1.- Installing the build package " class="wp-image-19683" srcset="https://www.osradar.com/wp-content/uploads/2020/04/1-7-1024x286.png 1024w, https://www.osradar.com/wp-content/uploads/2020/04/1-7-300x84.png 300w, https://www.osradar.com/wp-content/uploads/2020/04/1-7-768x214.png 768w, https://www.osradar.com/wp-content/uploads/2020/04/1-7-696x194.png 696w, https://www.osradar.com/wp-content/uploads/2020/04/1-7-1068x298.png 1068w, https://www.osradar.com/wp-content/uploads/2020/04/1-7.png 1334w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption>1.- Installing the build package </figcaption></figure>



<p>When the installation is finished, we will be able to execute the installation script.</p>



<pre class="wp-block-preformatted">:~$ curl https://nim-lang.org/choosenim/init.sh -sSf | sh
choosenim-init: Downloading choosenim-0.6.0_linux_amd64
 Downloading Nim 1.2.0 from nim-lang.org
 [##################################################] 100.0% 0kb/s
  Extracting nim-1.2.0-linux_x64.tar.xz
    Building Nim 1.2.0
   Compiler: Already built
      Tools: Already built
   Installed component 'nim'
   Installed component 'nimble'
   Installed component 'nimgrep'
   Installed component 'nimpretty'
   Installed component 'nimsuggest'
   Installed component 'testament'
    Switched to Nim 1.2.0
 choosenim-init: ChooseNim installed in /home/angelo/.nimble/bin
 choosenim-init: You must now ensure that the Nimble bin dir is in your PATH.
 choosenim-init: Place the following line in the ~/.profile or ~/.bashrc file.
 choosenim-init:     export PATH=/home/angelo/.nimble/bin:$PATH</pre>



<figure class="wp-block-image size-large"><img loading="lazy" width="771" height="373" src="https://www.osradar.com/wp-content/uploads/2020/04/2-5.png" alt="2.- Install Nim programming language on Ubuntu 20.04 /Debian 10" class="wp-image-19684" srcset="https://www.osradar.com/wp-content/uploads/2020/04/2-5.png 771w, https://www.osradar.com/wp-content/uploads/2020/04/2-5-300x145.png 300w, https://www.osradar.com/wp-content/uploads/2020/04/2-5-768x372.png 768w, https://www.osradar.com/wp-content/uploads/2020/04/2-5-696x337.png 696w" sizes="(max-width: 771px) 100vw, 771px" /><figcaption>2.- Install Nim programming language on Ubuntu 20.04 /Debian 10</figcaption></figure>



<p>In case curl is not installed you can install it with the following command:</p>



<pre class="wp-block-preformatted">:~$ sudo apt install curl</pre>



<p>Then have Nim installed. We have to make it available throughout the system.</p>



<p>So edit the <code>~/.profile</code> file:</p>



<pre class="wp-block-preformatted">:~$ nano ~/.profile</pre>



<p>And add the following:</p>



<pre class="wp-block-preformatted">export PATH=/home/your-home/.nimble/bin:$PATH</pre>



<figure class="wp-block-image size-large"><img loading="lazy" width="573" height="163" src="https://www.osradar.com/wp-content/uploads/2020/04/3-5.png" alt="3.- Editing the profile file" class="wp-image-19685" srcset="https://www.osradar.com/wp-content/uploads/2020/04/3-5.png 573w, https://www.osradar.com/wp-content/uploads/2020/04/3-5-300x85.png 300w" sizes="(max-width: 573px) 100vw, 573px" /><figcaption>3.- Editing the profile file</figcaption></figure>



<p>Replace <code>"your-home"</code> with your username or home.</p>



<p>Save the changes and close the file.</p>



<p>Appley the change by running:</p>



<pre class="wp-block-preformatted">:~$ nim -v
Nim Compiler Version 1.2.0 [Linux: amd64]
 Compiled at 2020-04-03
 Copyright (c) 2006-2020 by Andreas Rumpf
 active boot switches: -d:release</pre>



<figure class="wp-block-image size-large"><img loading="lazy" width="710" height="159" src="https://www.osradar.com/wp-content/uploads/2020/04/4-4.png" alt="4.- Nim version" class="wp-image-19686" srcset="https://www.osradar.com/wp-content/uploads/2020/04/4-4.png 710w, https://www.osradar.com/wp-content/uploads/2020/04/4-4-300x67.png 300w, https://www.osradar.com/wp-content/uploads/2020/04/4-4-696x156.png 696w" sizes="(max-width: 710px) 100vw, 710px" /><figcaption>4.- Nim version</figcaption></figure>



<h2>Testing Nim Installation</h2>



<p>Now it is time to test if the installation has worked.</p>



<p>So we&#8217;ll create the classic test program by displaying a message. This will serve the purpose.</p>



<p>The code files for the Nim language, they have a nim extension. So we will create one:</p>



<pre class="wp-block-preformatted">:~$ nano hello.nim</pre>



<p>And within this file add the following content:</p>



<pre class="wp-block-preformatted">echo "Hi, Osradar"</pre>



<p>Save the changes and close the file.</p>



<p>Now, compile the source file to generate the executable binary.</p>



<pre class="wp-block-preformatted">:~$ nim c hello.nim
Hint: used config file '/home/angelo/.choosenim/toolchains/nim-1.2.0/config/nim.cfg' [Conf]
 Hint: system [Processing]
 Hint: widestrs [Processing]
 Hint: io [Processing]
 Hint: hello [Processing]
 Hint: gcc -c  -w   -I/home/angelo/.choosenim/toolchains/nim-1.2.0/lib -I/home/angelo -o /home/angelo/.cache/nim/hello_d/stdlib_io.nim.c.o /home/angelo/.cache/nim/hello_d/stdlib_io.nim.c [Exec]
 Hint: gcc -c  -w   -I/home/angelo/.choosenim/toolchains/nim-1.2.0/lib -I/home/angelo -o /home/angelo/.cache/nim/hello_d/stdlib_system.nim.c.o /home/angelo/.cache/nim/hello_d/stdlib_system.nim.c [Exec]
 Hint: gcc -c  -w   -I/home/angelo/.choosenim/toolchains/nim-1.2.0/lib -I/home/angelo -o /home/angelo/.cache/nim/hello_d/@mhello.nim.c.o /home/angelo/.cache/nim/hello_d/@mhello.nim.c [Exec]
 Hint:  [Link]
 Hint: 14211 LOC; 3.140 sec; 15.887MiB peakmem; Debug build; proj: /home/angelo/hello.nim; out: /home/angelo/hello [SuccessX]</pre>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="209" src="https://www.osradar.com/wp-content/uploads/2020/04/6-4-1024x209.png" alt="6.- Testing nim on Ubuntu 20.04 /Debian 10" class="wp-image-19687" srcset="https://www.osradar.com/wp-content/uploads/2020/04/6-4-1024x209.png 1024w, https://www.osradar.com/wp-content/uploads/2020/04/6-4-300x61.png 300w, https://www.osradar.com/wp-content/uploads/2020/04/6-4-768x156.png 768w, https://www.osradar.com/wp-content/uploads/2020/04/6-4-696x142.png 696w, https://www.osradar.com/wp-content/uploads/2020/04/6-4-1068x218.png 1068w, https://www.osradar.com/wp-content/uploads/2020/04/6-4.png 1365w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption>6.- Testing nim on Ubuntu 20.04 /Debian 10</figcaption></figure>



<p>Remember that you have to specify the source file but also the full path.</p>



<p>Then, run it as follows:</p>



<pre class="wp-block-preformatted">~$ ./hello</pre>



<figure class="wp-block-image size-large"><img loading="lazy" width="633" height="104" src="https://www.osradar.com/wp-content/uploads/2020/04/7-4.png" alt="7.- Nim programming language working on Ubuntu 20.04 / Debian 10" class="wp-image-19688" srcset="https://www.osradar.com/wp-content/uploads/2020/04/7-4.png 633w, https://www.osradar.com/wp-content/uploads/2020/04/7-4-300x49.png 300w" sizes="(max-width: 633px) 100vw, 633px" /><figcaption>7.- Nim programming language working on Ubuntu 20.04 / Debian 10</figcaption></figure>



<p>So now we know that nim works and you can start working with him.</p>



<h2>Conclusion</h2>



<p>Programming is very important nowadays, so it requires programming languages to match. Today we have taught you how to install Nim on Ubuntu 20.04 / Debian 10 so you can have an ideal partner to make your applications.</p>



<p>Please share this post and join <a href="https://t.me/osradar" target="_blank" rel="noreferrer noopener" aria-label="our Telegram channel (opens in a new tab)">our Telegram channel</a>.</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/nim-programming-language-ubuntu-debian/">Install Nim programming language on Ubuntu 20.04 / Debian 10</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.osradar.com/nim-programming-language-ubuntu-debian/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
