2020. 1. 20. 23:47ㆍLIFE/Blog
Summary
- 로컬에 Ruby, Jekyll 설치 및 설정
- 블로그홈 생성
- Jekyll을 이용하여 직접 new home 생성해서 사용하기
- Jekyll theme을 이용하여 git clone으로 로컬에 복제하여 custumizing하여 사용하기
- Gitbuh pages 및 Repository 생성
- Github Pages에 Git Push해서 웹호스팅
[GitHub Pages 참고]
[오류 참고]
준비 사항
- Ruby 2.2.5 이상. 모든 개발환경 헤더 포함 : 루비 설치정보는 ruby -v 로 확인
- RubyGems : 명령어 gem -v 로 확인
- GCC 와 Make : 명령행 인터페이스에서 gcc -v 와 g++ -v, make -v 로 확인
$ ruby -v
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
$ gem -v
3.0.3
$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-1100.0.33.17)
Target: x86\_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ g++ -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-1100.0.33.17)
Target: x86\_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ make -v
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for i386-apple-darwin11.3.0
0. Homebrew로 상태 확인하기
오류 발생 때문에 뒤져보다보니 새로 설치하기 전 Homebrew로 확인하라고 해서 답답한 마음에 실행해 봄. 그 덕에 Xcode outdated 발견했으니 밑져야 본전. 한 번씩 확인해보자!
- Run 'brew doctor' before you install anything
- Run 'brew help' to get started
참고 : Homebrew 설치하기
$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for \*-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.
...
Warning: Your Xcode (9.4) is outdated.
Please update to Xcode 10.2 (or delete it).
Xcode can be updated from the App Store.
1. Xcode
- Xcode 10.0 이상 (Mac OS Mojave 이상 설치 가능)
$xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
이미 설치되어 있으나 명령어는 찾을 수 없다고 한다.
오류 해결 1) command로 xcode 삭제 및 재설치
- 이 방법으로 해봤는데, Xcode outdated 버전이 설치되었다. 결국 아래 2번 방법으로 재설치했다.
$ sudo rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install
xcode-select: note: install requested for command line developer tools
오류 해결 2) Xcode App Store 재설치 (Worked!!)
위의 1번 방법으로 명령어로 삭제하고 다시 설치를 해보았다. 하지만 결과는 똑같았다.
그래서 결국 Applications에서 Xcode를 삭제하고 App Store에서 새로 설치를 진행한 후 'xcode-select --install' 명령어를 재실행하니 설치가 진행된다. 그래도 터미널에서 'xcode -v'를 입력해도 command not foundㅇ이다.
Command Line Tools Version 확인
- Xcode 실행 > Preference > Locations Tab
: 2020.1월에 새로 설치했더니 11.3.1 버전이 설치되었다.
Ruby 설치 및 설정
Mac이라 Ruby가 이미 설치되어 있어서 바로 Jekyll 설치하려했더니 Gem File Permission Error가 발생했다. 내 맥북은 .bash_profile에 환경설정 추가하게 되어있다. 홈 경로에서 설정 파일 확인해서 추가하면 된다.
Ruby 설정
# 기본 설정
echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc
echo 'export GEM\_HOME=$HOME/gems' >> ~/.bashrc
echo 'export PATH=$HOME/gems/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
# 내 맥북 설정
$ echo '# Install Ruby Gems to ~/gems' >> ~/.bash\_profile
$ echo 'export GEM\_HOME=$HOME/gems' >> ~/.bash\_profile
$ echo 'export PATH=$HOME/gems/bin:$PATH' >> ~/.bash\_profile
$ source ~/.bash\_profile
Ruby 재설치
/usr/bin/ruby -e "$(curl -fsSL [https://raw.githubusercontent.com/Homebrew/install/master/install)"](https://raw.githubusercontent.com/Homebrew/install/master/install)")
...
\==> Installation successful!
\==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
[https://docs.brew.sh/Analytics](https://docs.brew.sh/Analytics)
\==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
[https://github.com/Homebrew/brew#donations](https://github.com/Homebrew/brew#donations)
\==> Next steps:
- Run `brew help` to get started
- Further documentation:
[https://docs.brew.sh](https://docs.brew.sh)
$ brew install ruby
\==> Installing dependencies for ruby: libyaml, [openssl@1.1](mailto:openssl@1.1) and readline
\==> Installing ruby dependency: libyaml
\==> Downloading [https://homebrew.bintray.com/bottles/libyaml-0.2.2.mojave.bottle.tar.gz](https://homebrew.bintray.com/bottles/libyaml-0.2.2.mojave.bottle.tar.gz)
######################################################################## 100.0%
\==> Pouring libyaml-0.2.2.mojave.bottle.tar.gz
🍺 /usr/local/Cellar/libyaml/0.2.2: 9 files, 291.6KB
\==> Installing ruby dependency: [openssl@1.1](mailto:openssl@1.1)
\==> Downloading [https://homebrew.bintray.com/bottles/openssl@1.1-1.1.1d.mojave.bottle.tar.gz](https://homebrew.bintray.com/bottles/openssl@1.1-1.1.1d.mojave.bottle.tar.gz)
\==> Downloading from [https://akamai.bintray.com/10/104ef018b7bb8fcc49f57e5a60359a28a02d480d85a959e61](https://akamai.bintray.com/10/104ef018b7bb8fcc49f57e5a60359a28a02d480d85a959e61)
######################################################################## 100.0%
\==> Pouring [openssl@1.1-1.1.1d.mojave.bottle.tar.gz](mailto:openssl@1.1-1.1.1d.mojave.bottle.tar.gz)
\==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
/usr/local/etc/openssl@1.1/certs
and run
/usr/local/opt/openssl@1.1/bin/c\_rehash
[openssl@1.1](mailto:openssl@1.1) is keg-only, which means it was not symlinked into /usr/local,
because openssl/libressl is provided by macOS so don't link an incompatible version.
If you need to have [openssl@1.1](mailto:openssl@1.1) first in your PATH run:
echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.bash\_profile
For compilers to find [openssl@1.1](mailto:openssl@1.1) you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"
\==> Summary
🍺 /usr/local/Cellar/openssl@1.1/1.1.1d: 7,983 files, 17.9MB
\==> Installing ruby dependency: readline
\==> Downloading [https://homebrew.bintray.com/bottles/readline-8.0.1.mojave.bottle.tar.gz](https://homebrew.bintray.com/bottles/readline-8.0.1.mojave.bottle.tar.gz)
\==> Downloading from [https://akamai.bintray.com/3c/3c754391e9d243835811d128771ca0f1a565024100fd2c287](https://akamai.bintray.com/3c/3c754391e9d243835811d128771ca0f1a565024100fd2c287)
######################################################################## 100.0%
\==> Pouring readline-8.0.1.mojave.bottle.tar.gz
\==> Caveats
readline is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.
For compilers to find readline you may need to set:
export LDFLAGS="-L/usr/local/opt/readline/lib"
export CPPFLAGS="-I/usr/local/opt/readline/include"
\==> Summary
🍺 /usr/local/Cellar/readline/8.0.1: 48 files, 1.5MB
\==> Installing ruby
\==> Downloading [https://homebrew.bintray.com/bottles/ruby-2.6.5.mojave.bottle.1.tar.gz](https://homebrew.bintray.com/bottles/ruby-2.6.5.mojave.bottle.1.tar.gz)
\==> Downloading from [https://akamai.bintray.com/da/da318a12d35502d95a8bea49f735bb74af72cdb38b687b2f5](https://akamai.bintray.com/da/da318a12d35502d95a8bea49f735bb74af72cdb38b687b2f5)
######################################################################## 100.0%
\==> Pouring ruby-2.6.5.mojave.bottle.1.tar.gz
\==> Caveats
By default, binaries installed by gem will be placed into:
/usr/local/lib/ruby/gems/2.6.0/bin
You may want to add this to your PATH.
ruby is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
If you need to have ruby first in your PATH run:
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash\_profile
For compilers to find ruby you may need to set:
export LDFLAGS="-L/usr/local/opt/ruby/lib"
export CPPFLAGS="-I/usr/local/opt/ruby/include"
\==> Summary
🍺 /usr/local/Cellar/ruby/2.6.5: 19,390 files, 31.1MB
\==> Caveats
\==> [openssl@1.1](mailto:openssl@1.1)
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
/usr/local/etc/openssl@1.1/certs
and run
/usr/local/opt/openssl@1.1/bin/c\_rehash
[openssl@1.1](mailto:openssl@1.1) is keg-only, which means it was not symlinked into /usr/local,
because openssl/libressl is provided by macOS so don't link an incompatible version.
If you need to have [openssl@1.1](mailto:openssl@1.1) first in your PATH run:
echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.bash\_profile
For compilers to find [openssl@1.1](mailto:openssl@1.1) you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"
\==> readline
readline is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.
For compilers to find readline you may need to set:
export LDFLAGS="-L/usr/local/opt/readline/lib"
export CPPFLAGS="-I/usr/local/opt/readline/include"
\==> ruby
By default, binaries installed by gem will be placed into:
/usr/local/lib/ruby/gems/2.6.0/bin
You may want to add this to your PATH.
ruby is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
If you need to have ruby first in your PATH run:
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash\_profile
For compilers to find ruby you may need to set:
export LDFLAGS="-L/usr/local/opt/ruby/lib"
export CPPFLAGS="-I/usr/local/opt/ruby/include"
Jekyll과 bundler 설치
역시 또 오류가 발생해있다. 일단 진행해보자.
I had the same issue on Mac OS Mojave and Xcode 11.2 and unf_ext 0.0.7.6.
To fix it, I downgraded Xcode command line tools to Xcode 10.3 and bundle install worked as expected.
*내 Xcode 버전은 9.## 인데 안된다. 근데 터미널에서는 xcode 명령어를 인식하지 못한다. 왜지??
$ gem install jekyll bundler
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
current directory: /Users/minky/gems/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -I /Library/Ruby/Site/2.3.0 -r ./siteconf20200129-1053-1noucbh.rb extconf.rb
creating Makefile
current directory: /Users/minky/gems/gems/http\_parser.rb-0.6.0/ext/ruby\_http\_parser
make "DESTDIR=" clean
current directory: /Users/minky/gems/gems/http\_parser.rb-0.6.0/ext/ruby\_http\_parser
make "DESTDIR="
make: \*\*\* No rule to make target `/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin18/ruby/config.h', needed by`ruby\_http\_parser.o'. Stop.
make failed, exit code 2
Gem files will remain installed in /Users/minky/gems/gems/http\_parser.rb-0.6.0 for inspection.
Results logged to /Users/minky/gems/extensions/universal-darwin-18/2.3.0/http\_parser.rb-0.6.0/gem\_make.out
Successfully installed bundler-2.1.4
Parsing documentation for bundler-2.1.4
Done installing documentation for bundler after 7 seconds
1 gem installed
$ gem install --user-install bundler jekyll
WARNING: You don't have /Users/minky/.gem/ruby/2.6.0/bin in your PATH,
gem executables will not run.
Successfully installed bundler-2.1.4
Parsing documentation for bundler-2.1.4
Installing ri documentation for bundler-2.1.4
Done installing documentation for bundler after 4 seconds
Fetching colorator-1.1.0.gem
Fetching i18n-1.8.2.gem
Successfully installed colorator-1.1.0
Building native extensions. This could take a while...
Successfully installed http\_parser.rb-0.6.0
Building native extensions. This could take a while...
Successfully installed eventmachine-1.2.7
Successfully installed em-websocket-0.5.1
HEADS UP! i18n 1.1 changed fallbacks to exclude default locale.
But that may break your application.
If you are upgrading your Rails application from an older version of Rails:
Please check your Rails app for 'config.i18n.fallbacks = true'.
If you're using I18n (>= 1.1.0) and Rails (< 5.2.2), this should be
'config.i18n.fallbacks = \[I18n.default\_locale\]'.
If not, fallbacks will be broken in your app by I18n 1.1.x.
If you are starting a NEW Rails application, you can ignore this notice.
For more info see:
[https://github.com/svenfuchs/i18n/releases/tag/v1.1.0](https://github.com/svenfuchs/i18n/releases/tag/v1.1.0)
Successfully installed i18n-1.8.2
Building native extensions. This could take a while...
Successfully installed ffi-1.12.1
Building native extensions. This could take a while...
Successfully installed sassc-2.2.1
Successfully installed jekyll-sass-converter-2.0.1
Successfully installed rb-fsevent-0.10.3
Successfully installed rb-inotify-0.10.1
Successfully installed listen-3.2.1
Successfully installed jekyll-watch-2.2.1
Successfully installed kramdown-2.1.0
Successfully installed kramdown-parser-gfm-1.1.0
Successfully installed liquid-4.0.3
Successfully installed mercenary-0.3.6
Successfully installed forwardable-extended-2.6.0
Successfully installed pathutil-0.16.2
Successfully installed rouge-3.15.0
Successfully installed safe\_yaml-1.0.5
Successfully installed unicode-display\_width-1.6.1
Successfully installed terminal-table-1.8.0
---
Jekyll 4.0 comes with some major changes, notably:
- Our `link` tag now comes with the `relative_url` filter incorporated into it.
You should no longer prepend `{{ site.baseurl }}` to `{% link foo.md %}`
For further details: [https://github.com/jekyll/jekyll/pull/6727](https://github.com/jekyll/jekyll/pull/6727)
- Our `post_url` tag now comes with the `relative_url` filter incorporated into it.
You shouldn't prepend `{{ site.baseurl }}` to `{% post_url 2019-03-27-hello %}`
For further details: [https://github.com/jekyll/jekyll/pull/7589](https://github.com/jekyll/jekyll/pull/7589)
- Support for deprecated configuration options has been removed. We will no longer
output a warning and gracefully assign their values to the newer counterparts
internally.
---
Successfully installed jekyll-4.0.0
Parsing documentation for colorator-1.1.0
Installing ri documentation for colorator-1.1.0
Parsing documentation for http\_parser.rb-0.6.0
unknown encoding name "chunked\\r\\n\\r\\n25" for ext/ruby\_http\_parser/vendor/http-parser-java/tools/parse\_tests.rb, skipping
Installing ri documentation for http\_parser.rb-0.6.0
Parsing documentation for eventmachine-1.2.7
Installing ri documentation for eventmachine-1.2.7
Parsing documentation for em-websocket-0.5.1
Installing ri documentation for em-websocket-0.5.1
Parsing documentation for i18n-1.8.2
Installing ri documentation for i18n-1.8.2
Parsing documentation for ffi-1.12.1
Installing ri documentation for ffi-1.12.1
Parsing documentation for sassc-2.2.1
Installing ri documentation for sassc-2.2.1
Parsing documentation for jekyll-sass-converter-2.0.1
Installing ri documentation for jekyll-sass-converter-2.0.1
Parsing documentation for rb-fsevent-0.10.3
Installing ri documentation for rb-fsevent-0.10.3
Parsing documentation for rb-inotify-0.10.1
Installing ri documentation for rb-inotify-0.10.1
Parsing documentation for listen-3.2.1
Installing ri documentation for listen-3.2.1
Parsing documentation for jekyll-watch-2.2.1
Installing ri documentation for jekyll-watch-2.2.1
Parsing documentation for kramdown-2.1.0
Installing ri documentation for kramdown-2.1.0
Parsing documentation for kramdown-parser-gfm-1.1.0
Installing ri documentation for kramdown-parser-gfm-1.1.0
Parsing documentation for liquid-4.0.3
Installing ri documentation for liquid-4.0.3
Parsing documentation for mercenary-0.3.6
Installing ri documentation for mercenary-0.3.6
Parsing documentation for forwardable-extended-2.6.0
Installing ri documentation for forwardable-extended-2.6.0
Parsing documentation for pathutil-0.16.2
Installing ri documentation for pathutil-0.16.2
Parsing documentation for rouge-3.15.0
Installing ri documentation for rouge-3.15.0
Parsing documentation for safe\_yaml-1.0.5
Installing ri documentation for safe\_yaml-1.0.5
Parsing documentation for unicode-display\_width-1.6.1
Installing ri documentation for unicode-display\_width-1.6.1
Parsing documentation for terminal-table-1.8.0
Installing ri documentation for terminal-table-1.8.0
Parsing documentation for jekyll-4.0.0
Installing ri documentation for jekyll-4.0.0
Done installing documentation for colorator, http\_parser.rb, eventmachine, em-websocket, i18n, ffi, sassc, jekyll-sass-converter, rb-fsevent, rb-inotify, listen, jekyll-watch, kramdown, kramdown-parser-gfm, liquid, mercenary, forwardable-extended, pathutil, rouge, safe\_yaml, unicode-display\_width, terminal-table, jekyll after 52 seconds
24 gems installed
sudo 권한으로 설치 강력 권장
$ sudo gem install bundler
Fetching bundler-2.1.4.gem
bundler's executable "bundler" conflicts with /usr/local/lib/ruby/gems/2.6.0/bin/bundler
Overwrite the executable? \[yN\] Y
Successfully installed bundler-2.1.4
Parsing documentation for bundler-2.1.4
Installing ri documentation for bundler-2.1.4
Done installing documentation for bundler after 4 seconds
1 gem installed
$ sudo gem install -n /usr/local/bin/ jekyll
Fetching concurrent-ruby-1.1.5.gem
Fetching public\_suffix-4.0.3.gem
Fetching addressable-2.7.0.gem
Successfully installed public\_suffix-4.0.3
Successfully installed addressable-2.7.0
Successfully installed concurrent-ruby-1.1.5
Fetching jekyll-4.0.0.gem
---
Jekyll 4.0 comes with some major changes, notably:
- Our `link` tag now comes with the `relative_url` filter incorporated into it.
You should no longer prepend `{{ site.baseurl }}` to `{% link foo.md %}`
For further details: [https://github.com/jekyll/jekyll/pull/6727](https://github.com/jekyll/jekyll/pull/6727)
- Our `post_url` tag now comes with the `relative_url` filter incorporated into it.
You shouldn't prepend `{{ site.baseurl }}` to `{% post_url 2019-03-27-hello %}`
For further details: [https://github.com/jekyll/jekyll/pull/7589](https://github.com/jekyll/jekyll/pull/7589)
- Support for deprecated configuration options has been removed. We will no longer
output a warning and gracefully assign their values to the newer counterparts
internally.
---
Successfully installed jekyll-4.0.0
Parsing documentation for public\_suffix-4.0.3
Installing ri documentation for public\_suffix-4.0.3
Parsing documentation for addressable-2.7.0
Installing ri documentation for addressable-2.7.0
Parsing documentation for concurrent-ruby-1.1.5
Installing ri documentation for concurrent-ruby-1.1.5
Parsing documentation for jekyll-4.0.0
Installing ri documentation for jekyll-4.0.0
Done installing documentation for public\_suffix, addressable, concurrent-ruby, jekyll after 9 seconds
4 gems installed
기본 블로그 생성해보기
참고
새 블로그 생성
$ jekyll new blog
Running bundle install in /Users/minky/Documents/blog...
Bundler: Fetching gem metadata from [https://rubygems.org/](https://rubygems.org/)...........
Bundler: Fetching gem metadata from [https://rubygems.org/](https://rubygems.org/).
Bundler: Resolving dependencies...
...
Bundler: Bundle complete! 6 Gemfile dependencies, 30 gems now installed.
Bundler: Use `bundle info [gemname]` to see where a bundled gem is installed.
New jekyll site installed in /Users/minky/Documents/blog.
서버 구동
서버 실행
$ cd blog/ $ bundle exec jekyll serve Configuration file: /Users/minky/Documents/blog/\_config.yml Source: /Users/minky/Documents/blog Destination: /Users/minky/Documents/blog/\_site Incremental build: disabled. Enable with --incremental Generating... Jekyll Feed: Generating feed for posts done in 0.435 seconds. Auto-regeneration: enabled for '/Users/minky/Documents/blog' Server address: [http://127.0.0.1:4000/](http://127.0.0.1:4000/) Server running... press ctrl-c to stop. \[2020-01-30 16:32:07\] ERROR \`/favicon.ico' not found.
접속 및 확인
http://127.0.0.1:4000/
서버 호스팅
특정 IP로 서버를 호스팅해서 외부에서 접속 가능
$ bundle exec jekyll serve -H 192.168.0.8
'LIFE > Blog' 카테고리의 다른 글
Tistory에 TOC 추가하기 (0) | 2020.10.03 |
---|---|
LaTex 수식 입력 (0) | 2020.02.03 |
특수문자 입력하기 (0) | 2020.02.03 |
GitHub Pages Blog 3 - Jekyll Theme (0) | 2020.01.31 |