LoginSignup
5
5

More than 5 years have passed since last update.

Mac で Julia #1

Last updated at Posted at 2018-08-17

速くていろいろ良さげなJuliaという言語が2018年8月にVer.1.0になりましたのでMacで環境構築してみました。

ダウンロード&インストール

  • 公式サイトからダウンロードする手もありますが、brew(cask)でもインストールできるようなのでインストールします。
sh-3.2$ brew cask info julia
julia: 1.0.0
https://julialang.org/
Not installed
From: https://github.com/Homebrew/homebrew-cask/blob/master/Casks/julia.rb
==> Name
Julia
==> Artifacts
Julia-1.0.app (App)
/Applications/Julia-1.0.app/Contents/Resources/julia/bin/julia (Binary)
sh-3.2$
  • ちゃんと1.0のようですね。
sh-3.2$ brew cask install julia
Updating Homebrew...
==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations
==> Auto-updated Homebrew!
・・・中略
==> Satisfying dependencies
==> Downloading https://julialang-s3.julialang.org/bin/mac/x64/1.0/julia-1.0.0-mac64.dmg
######################################################################## 100.0%
==> Verifying checksum for Cask julia
==> Installing Cask julia
==> Moving App 'Julia-1.0.app' to '/Applications/Julia-1.0.app'.
==> Linking Binary 'julia' to '/usr/local/bin/julia'.
🍺  julia was successfully installed!
sh-3.2$ julia -v
julia version 1.0.0
sh-3.2$
  • インストールOKですbrewって素晴らしいですよね。

また、/Applications以下にもappがインストールされて、それをダブルクリックするとこんな画面がでました。

julia.png

Visual Studio Codeで機能拡張

  • 公式サイトのJulia Editors and IDEsを見るとVS Code Extensionもあるそうなのでこれをメインに環境構築したいと思います。
  • 機能拡張タブからjulia機能拡張をインストールします。現時点ではv0.10.3でした。

juliaex.png

VS Code で 動作確認

  • juliaの拡張子はjlだそうなので、test.jlというのを作成します。
  • 適当にコードを書いて...コメントは#のようです。
# Hello World
str = "World!"
println("Hello $(str)");

#= 
    function
=# 
add(x,y) = x + y
v = 10;
println(add(v,3));
  • 実行!
sh-3.2$ julia test.jl
Hello World!
13
sh-3.2$
  • ばっちりですね。

  • 次からは、ドキュメントに沿って試していきたいと思います。

5
5
1

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
5
5