[mac] install Shiny Server

Published by onesixx on

https://github.com/talonsensei/codex-python/wiki/Howto-Install-Shiny-Server-on-OSX
https://github.com/rstudio/shiny-server/wiki/Building-Shiny-Server-from-Source
http://www.ducheneaut.info/installing-shiny-server-on-mac-os-x/

 

R for Mac OS X Developer’s Page  
github.com/nsh87/shiny Shiny
Shiny Server 

Prerequisites

다음 software는 시스템에서 사용가능해야한다. (/usr/local/Cellar 에서 확인)
The required software (python, cmake, gcc, g++, git) can all be installed using homebrew 

cmake

http://brewformulas.org/Cmake
|➜ brew install cmake

(>= 2.8.10)

|➜  cmake --version
cmake version 3.8.0
CMake suite maintained and supported by Kitware (kitware.com/cmake)

gcc (g++)

http://brewformulas.org/Gcc

|➜ brew install gcc

(> =  4.8) 

|➜ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.1.0 (clang-802.0.41)
Target: x86_64-apple-darwin16.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

git

|➜ brew install git

..

|➜ git --version
git version 2.12.2

python

|➜ brew cask install python

2.6 or 2.7 (Really. 3.x will not work)

|➜ python --version
Python 2.7.10

R-base-devel

base R보다는 devel 팩키지가 필요 Component가 적다.

|➜ R --version
R version 3.3.3 (2017-03-06) -- "Another Canoe"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin16.4.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
http://www.gnu.org/licenses/.

Shiny Package설치

sudo su - -c "R -e \"install.packages('shiny', repos='https://cran.rstudio.com/')\""
sudo su - onesixx -c "R -e \"install.packages('shiny', repos='https://cran.rstudio.com/')\""

> .libPaths()
[1] “/usr/local/lib/R/3.4/site-library”
[2] “/usr/local/Cellar/r/3.4.4/lib/R/library”

또는 R에서 

> install.packages("shiny", repo="http://cran.rstudio.org", type="source")
Installing package into ‘/usr/local/lib/R/3.3/site-library’
(as‘lib’ is unspecified)
also installing the dependencies ‘Rcpp’, ‘httpuv’, ‘mime’, ‘jsonlite’, ‘xtable’, ‘digest’,
 ‘htmltools’, ‘R6’, ‘sourcetools’

trying URL 'https://cran.rstudio.com/src/contrib/Rcpp_0.12.7.tar.gz'
trying URL 'https://cran.rstudio.com/src/contrib/httpuv_1.3.3.tar.gz'
trying URL 'https://cran.rstudio.com/src/contrib/mime_0.5.tar.gz'
trying URL 'https://cran.rstudio.com/src/contrib/jsonlite_1.1.tar.gz'
trying URL 'https://cran.rstudio.com/src/contrib/xtable_1.8-2.tar.gz'
trying URL 'https://cran.rstudio.com/src/contrib/digest_0.6.10.tar.gz'
trying URL 'https://cran.rstudio.com/src/contrib/htmltools_0.3.5.tar.gz'
trying URL 'https://cran.rstudio.com/src/contrib/R6_2.2.0.tar.gz'
trying URL 'https://cran.rstudio.com/src/contrib/sourcetools_0.1.5.tar.gz'
trying URL 'https://cran.rstudio.com/src/contrib/shiny_0.14.2.tar.gz'
....

Installation

GitHub에서 repository(shiny server 코드)를 Clone

⇒  cd ~/Downloads
~/Downloads|⇒  git clone https://github.com/rstudio/shiny-server.git
Cloning into 'shiny-server'...
remote: Counting objects: 9737, done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 9737 (delta 3), reused 0 (delta 0), pack-reused 9720
Receiving objects: 100% (9737/9737), 14.24 MiB | 1.45 MiB/s, done.
Resolving deltas: 100% (3501/3501), done.

project를 build할 temporary 폴더를 만들기 

~/Downloads|➜ cd shiny-server
~/Downloads/shiny-server|➜ mkdir tmp
~/Downloads/shiny-server|➜ cd tmp
~/Downloads/shiny-server/tmp|➜ sh ../packaging/make-package.sh

path 설정

Add the bin directory to the path so we can reference node

~/Downloads/shiny-server/tmp|➜ DIR=`pwd`
~/Downloads/shiny-server/tmp|➜ PATH=$DIR/../bin:$PATH
~/Downloads/shiny-server/tmp|➜ PYTHON=`which python`
⇒ pwd
~/Downloads/shiny-server/tmp

⇒ export PATH=~/Downloads/shiny-server/tmp/../bin:$PATH
또는
⇒ export PATH=~/Downloads/shiny-server/bin:$PATH

⇒ which python
/usr/bin/python

⇒ python --version
Python 2.7.13

PATH 추가

⇒ vi ~/.zshrc

PATH 적용

⇒  source ~/.zshrc

launcher.cc 수정

~/Downloads/shiny-server/src/launcher.cc

https://gist.github.com/talonsensei/9124230

Make all of the edits to the file that are contained in this gist (original commit link is here) in this gist
(original commit link is here )

 

/*
 * launcher.cc
 *
 * Copyright (C) 2009-13 by RStudio, Inc.
 *
 * This program is licensed to you under the terms of version 3 of the
 * GNU Affero General Public License. This program is distributed WITHOUT
 * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
 * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
 *
 */
 #include <unistd.h>
 #include <sys/param.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <libgen.h>
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <string>
 #include <vector>
 #include <algorithm>
 #ifdef __APPLE__
  #include <libproc.h>
 #endif
 #include "launcher.h"

 // The purpose of this executable is to provide a clean entry point for
 // shiny-server, that is capable of running either daemonized or not.

 int findBaseDir(std::string* shinyServerPath);

 int main(int argc, char **argv) {

   // If the caller requested daemonizing, do it.
   for (int i = 1; i < argc; i++) {
     if (strcmp(argv[i], "--daemonize") == 0) {
       daemon(1, 0);
       break;
     }
   }


   std::string shinyServerPath;
   int result = findBaseDir(&shinyServerPath);
   if (result != 0)
     return result;

   std::string nodePath = shinyServerPath + "/ext/node/bin/shiny-server";
   std::string mainPath = shinyServerPath + "/lib/main.js";

   // Two extra args: one for mainPath, one for NULL terminator
   char** newargs = new char*[argc + 2];
   newargs[0] = strdup(nodePath.c_str());
   newargs[1] = strdup(mainPath.c_str());
   for (int i = 0; i < argc - 1; i++) {
     newargs[i + 2] = argv[i + 1];
   }
   newargs[argc + 1] = NULL;

   execv(nodePath.c_str(), newargs);

   // This will actually never get called.
   free(newargs[0]);
   free(newargs[1]);
   delete newargs;

   return 0;
 }

 // Determines the base dir of the shiny-server instance that's being invoked,
 // by calling readlink on /proc/<pid>/exe.
 int findBaseDir(std::string* shinyServerPath) {

#ifdef __APPLE__
  char execPath[PROC_PIDPATHINFO_MAXSIZE];
  if (!proc_pidpath(getpid(), execPath, sizeof(execPath))) {
    perror("proc_pidpath");
    // unexpected error
    return 2;
  }
#else // assuming Linux
   char execPath[MAXPATHLEN + 1];
   int cn = snprintf(execPath, MAXPATHLEN + 1, "/proc/%d/exe", getpid());
   if (cn < 0 || cn > MAXPATHLEN) {
     // Not expected
     return 2;
   }

   struct stat execStat;
   if (lstat(execPath, &execStat)) {
     if (errno == ENOENT)
       fprintf(stderr, "/proc/%d/exe doesn't exist--got Linux?\n", getpid());
     else
       fprintf(stderr, "Fatal error calling lstat: %d\n", errno);
     return 1;
   }

   if (!S_ISLNK(execStat.st_mode)) {
     fprintf(stderr, "/proc/%d/exe was not a symlink\n", getpid());
     return 1;
   }

   if (execStat.st_size > MAXPATHLEN) {
     fprintf(stderr, "Link resolved to an unexpectedly long path\n");
     return 1;
   }
   ssize_t charsNeeded = execStat.st_size > 0 ? execStat.st_size : MAXPATHLEN;

   std::vector<char> execBuf(charsNeeded + 1, 0);
   ssize_t cb = readlink(execPath, &execBuf[0], execBuf.size());
   if (cb < 0) {
     fprintf(stderr, "Fatal error calling readlink: %d\n", errno);
     return 1;
   }
   std::copy(execBuf.begin(), execBuf.begin() + cb, execPath);
   execPath[cb] = '\0';

#endif
   *shinyServerPath = dirname(dirname(execPath));

   return 0;
 }

드디어 설치 시작

cmake를 활용하여 make 작업준비

cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DPYTHON="$PYTHON" ../

-DCMAKE_INSTALL_PREFIX 에는 설치할 폴더를 
-DPYTHON 에는 python설치된 폴더(which python)를 

~/Downloads/shiny-server/tmp|➜ cmake -DCMAKE_INSTALL_PREFIX=/usr/local/etc -DPYTHON="$PYTHON" ../
-- The C compiler identification is AppleClang 8.1.0.8020042
-- The CXX compiler identification is AppleClang 8.1.0.8020042
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
mkdir: cannot create directory '/Users/onesixx/Downloads/shiny-server/tmp/external/pandoc/pandoc-1.12.3.zip': File exists
mkdir: cannot create directory '/Users/onesixx/Downloads/shiny-server/tmp/external/pandoc/pandoc-1.12.3.zip': File exists
Archive:  /Users/onesixx/Downloads/shiny-server/tmp/external/pandoc/pandoc-1.12.3.zip
  inflating: /Users/onesixx/Downloads/shiny-server/ext/pandoc/static/pandoc
Archive:  /Users/onesixx/Downloads/shiny-server/tmp/external/pandoc/pandoc-1.12.3.zip
  inflating: /Users/onesixx/Downloads/shiny-server/ext/pandoc/static/pandoc-citeproc
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/onesixx/Downloads/shiny-server/tmp

 

# Get an error here? Check the “How do I set the cmake Python version?” question below
# Recompile the npm modules included in the project
make ==Built target node

~/Downloads/shiny-server/tmp|➜ make
~/Downloads/shiny-server/tmp|➜ mkdir ../build

(cd .. && external/node/install-node.sh)
(cd .. && bin/npm --python="$PYTHON" install)
(cd .. && ext/node/lib/node_modules/npm/node_modules/node_gyp/bin/node-gyp.js --python="$PYTHON" rebuild)

 

 

29

shasum -a 256

(cd .. && external/node/install-node.sh)

 

 

exec “/usr/local/Cellar/node/10.0.0/bin/node” “$dir ……….js” “[email protected]

exec “/usr/local/Cellar/node/10.0.0/bin/node” “@0”

(cd .. && bin/npm --python="$PYTHON" install)
(cd .. && ext/node/lib/node_modules/npm/node_modules/node_gyp/bin/node-gyp.js --python="$PYTHON" rebuild)

 

 

 

에러 발생시

~/Downloads/shiny-server/tmp|➜  (cd .. && ./bin/npm --python="$PYTHON" install)
./bin/npm: line 4: /Users/onesixx/Downloads/shiny-server/bin/../ext/node/bin/node: cannot execute binary file
./bin/npm: line 4: /Users/onesixx/Downloads/shiny-server/bin/../ext/node/bin/node: Undefined error: 0

https://gist.github.com/DanHerbert/9520689

# Install the software at the predefined location

sudo make install

 

cd .. && ./bin/npm –python=”/usr/bin/python” install

cd /Users/onesixx/Downloads/shiny-server/tmp

cd .. && ./bin/node ./ext/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js –python=”/usr/local/bin/python” rebuild

 

 

Post-Install

Shiny Server will look for resources in specific locations.

Some of these (log directories, application directories, etc.) can be modified using a configuration file stored at /etc/shiny-server/shiny-server.conf   If no such file is provided, the default configuration will be used.
The following commands prepare a system for such a configuration.

# Place a shortcut to the shiny-server executable in /usr/bin

sudo ln -s /usr/local/shiny-server/bin/shiny-server /usr/bin/shiny-server

 

sudo ln -s /usr/local/etc/shiny-server/bin/shiny-server /usr/bin/shiny-server

 

*Operation not permitted 에러시, ‘Rootless’ 끄기

http://www.ducheneaut.info/installing-shiny-server-on-mac-os-x/

http://wiki.freegeek.org/index.php/Mac_OSX_adduser_script

http://docs.rstudio.com/shiny-server/#home_user

# Create shiny user.
 On some systems, you may need to specify the full path to ‘useradd’

sudo useradd -r -m shiny

 

|➜  dscl . -create /Users/shiny

Create the shiny user that the server will run under.
The instructions call for useraddbut that doesn’t exist in OSX, so we will have to manually do it with dscl

~|⇒  dscl . -list /Users UniqueID | awk '{print $2}' | sort -ug | tail -1
501

sudo dscl . -create /Users/shiny
sudo dscl . -create /Users/shiny Password "shiny"
sudo dscl . -create /Users/shiny UserShell /bin/zsh
sudo dscl . -create /Users/shiny Realname "Shiny Server"
sudo dscl . -create /Users/shiny PrimaryGroupID "80"
sudo dscl . -create /Users/shiny UniqueID "502"
sudo dscl . -create /Users/shiny NFSHomeDirectory "/Users/shiny"

It may be necessary to go into System Preferences/Users & Groups/ GUI
and change the password for the shiny user.

You must be able to su to the shiny user before continuing.

디렉토리 만들기

# Create log, config, and application directories
sudo mkdir -p /var/log/shiny-server
sudo chown shiny /var/log/shiny-server

sudo mkdir -p /etc/shiny-server


sudo mkdir -p /srv/shiny-server

sudo mkdir -p /var/lib/shiny-server

Log

/|➜ sudo mkdir -p /usr/local/var/log/shiny-server

/|➜ sudo chown shiny /usr/local/var/log/shiny-server

Config

/|➜ sudo mkdir -p /etc/shiny-server

shiny-server.conf, …

기본 document (applications directory, all apps go here)

sudo mkdir -p /srv/shiny-server 대신에 

/|➜ sudo mkdir -p /usr/local/var/shiny-server

——————————————————————————————

At this point, you should be able to follow the Configuration section of the README to begin serving some Shiny applications.

|⇒ sudo vi shiny-server.conf
|⇒ sudo cp -r /Users/onesixx/Downloads/shiny-server/samples/* /srv/shiny-server
|⇒ sudo vi com.xoma.shiny-server.plist

 

/etc/shiny-server|➜ sudo vi shiny-server.conf

https://github.com/rstudio/shiny-server/blob/master/config/default.config

# Instruct Shiny Server to run applications as the user "shiny"
run_as shiny;

# Define a server that listens on port 3838
server {
  listen 3838;

  # Define a location at the base URL
  location / {

    # Host the directory of Shiny Apps stored in this directory
    site_dir /srv/shiny-server;

    # Log all Shiny output to files in this directory
    log_dir /var/log/shiny-server;

    # When a user visits the base URL rather than a particular application,
    # an index of the applications available in this directory will be shown.
    directory_index on;
  }
}
run_as shiny;

server {
  listen 3838;

  location / {
    site_dir /usr/local/var/shiny-server;
    log_dir /usr/local/var/log/shiny-server;
    directory_index on;
  }
}

샘플 사이트 기본doc으로 복사하기

|⇒ sudo cp -r /Users/onesixx/Downloads/shiny-server/samples/* /usr/local/var/shiny-server

서비스 

/Library/LaunchDaemons|➜ sudo vi com.xoma.shiny-server.plist
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
   <key>Disabled</key>
   <true/>
   <key>EnvironmentVariables</key>
   <dict>
      <key>PATH</key>
      <string>/usr/local/bin/</string>
   </dict>
   <key>GroupName</key>
   <string>admin</string>
   <key>KeepAlive</key>
   <true/>
   <key>Label</key>
   <string>com.xoma.shiny-server</string>
   <key>Program</key>
   <string>/usr/bin/shiny-server</string>
   <key>RunAtLoad</key>
   <true/>
   <key>UserName</key>
   <string>shiny</string>
   <key>WorkingDirectory</key>
   <string>/usr/local/shiny-server</string>
 </dict>
 </plist>

 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Disabled</key>
  <true/>
  <key>EnvironmentVariables</key>
  <dict>
     <key>PATH</key>
     <string>/usr/local/bin/</string>
  </dict>
  <key>GroupName</key>
  <string>admin</string>
  <key>KeepAlive</key>
  <true/>
  <key>Label</key>
  <string>com.xoma.shiny-server</string>
  <key>Program</key>
  <string>/usr/bin/shiny-server</string>
  <key>RunAtLoad</key>
  <true/>
  <key>UserName</key>
  <string>shiny</string>
  <key>WorkingDirectory</key>
  <string>/usr/local/etc/shiny-server</string>
</dict>
</plist>

 

 

Start the server with

sudo chown root:wheel /Library/LaunchDaemons/com.xoma.shiny-server.plist
sudo chmod 644 /Library/LaunchDaemons/com.xoma.shiny-server.plist

sudo launchctl load -w /Library/LaunchDaemons/com.xoma.shiny-server.plist

 

sudo chown root:wheel /Library/LaunchDaemons/com.xoma.shiny-server.plist
sudo chmod 644 /Library/LaunchDaemons/com.xoma.shiny-server.plist
sudo launchctl load -w /Library/LaunchDaemons/com.xoma.shiny-server.plist

you should be able to start the server from the command line by executing shiny-server.

If you’d like Shiny Server to start automatically when your machine is booted, see the associated question in the F.A.Q. below.

⇒ sudo launchctl load -w /Library/LaunchDaemons/com.xoma.shiny-server.plist
/Library/LaunchDaemons/com.xoma.shiny-server.plist: Path had bad ownership/permissions

⇒ sudo chown root:wheel /Library/LaunchDaemons/com.xoma.shiny-server.plist
⇒ sudo chmod 644 /Library/LaunchDaemons/com.xoma.shiny-server.plist
⇒ sudo launchctl load -w /Library/LaunchDaemons/com.xoma.shiny-server.plist
/Library/LaunchDaemons/com.xoma.shiny-server.plist: Invalid or missing Program/ProgramArguments

⇒ sudo launchctl unload -w /Library/LaunchDaemons/com.xoma.shiny-server.plist
/Library/LaunchDaemons/com.xoma.shiny-server.plist: Could not find specified service

⇒ sudo launchctl load -w /Library/LaunchDaemons/com.xoma.shiny-server.plist
/Library/LaunchDaemons/com.xoma.shiny-server.plist: Invalid or missing Program/ProgramArguments

 

Frequently Asked Questions

What if Python 2.6 or 2.7 isn’t installed or isn’t the default?

The cmake … line above requires that the PYTHON environment variable be set to an installation of Python 2.6.x or 2.7.x (no older, no newer). Many Linux distributions maintain multiple versions of Python in their repositories. Some older distributions will default to an older version of Python but also provide a python26 package for Python 2.6. Some newer distributions will default to Python 3, but provide a python2 package for Python 2.7. It’s very likely that some package repository hosts either Python 2.6 or 2.7 for your distribution.

Once Python 2.6 or 2.7 is installed on your system, it still may be necessary to distinguish which version of Python should be used, as the default may be an older or newer version. To do this, you can alter the line above which sets Python to either

PYTHON=`which python2`
#   ...OR...
PYTHON=`which python26`

Once Python has been properly set, the command $PYTHON –version should echo Python 2.6.x or Python 2.7.x.

How do I set the cmake Python Version?

The answer above should solve this issue for most people. If you properly set PYTHON before running cmake, it’s less likely you’ll have any problems. However, some distributions are known to be a bit more stubborn about letting you override the default version of Python. In these cases, you may need to do some extra work to make your system default to using Python 2.6 or 2.7, if just while installing Shiny Server.

The easiest way to go about this is to add a reference to the desired version of Python earlier in your $PATH than Python is currently. Often times, /usr/local/bin/ is earlier in the list of $PATH directories than the default locations for python. If so, you can create a link to the desired version of python in /usr/local/bin using the following command, after first checking to ensure that you won’t overwrite anything stored at /usr/local/bin/python:

sudo ln -s $PYTHON /usr/local/bin/python

You can then try the cmake step above again — hopefully with more success this time. You’ll likely want to remove this link when the installation is complete using sudo rm /usr/local/bin/python.

What if a sufficiently recent version of cmake isn’t available?

Shiny Server requires version 2.8.10 or newer of cmake. Some distributions will not have this recent of a version of cmake available in their repositories. In this case, cmake must be built from source. Building cmake from source is often as simple as:

wget http://www.cmake.org/files/v2.8/cmake-2.8.11.2.tar.gz
tar xzf cmake-2.8.11.2.tar.gz
cd cmake-2.8.11.2
./configure
make
sudo make install

How can I make Shiny Server start automatically?

Some newer systems use Upstart to manage system daemons. If your distribution has Upstart available, we recommend using the Upstart script we provide to automatically run Shiny Server on boot. You can install this script using the following command:

sudo wget\
  https://raw.github.com/rstudio/shiny-server/master/config/upstart/shiny-server.conf\
  -O /etc/init/shiny-server.conf

You can then run sudo start shiny-server to start Shiny Server.

If your distribution does not use upstart, you’ll likely need to create an init.d script for Shiny Server. We provide some init.d scripts here that may serve as a useful guide for you, but they may need some modification to work as expected on your distribution. Unfortunately, because the init.d files vary from distribution to distribution, we aren’t able to provide exhaustive documentation on how to make this work on your particular setup. Once properly configured, you can run sudo /etc/init.d/shiny-server start to manually start Shiny Server.

⇒  dscl . -read /Users/root UserShell
UserShell: /bin/sh

⇒  dscl . -read /Users/onesixx UserShell
UserShell: /bin/zsh

⇒  dscl . -read /Users/shiny UserShell
UserShell: /bin/sh

⇒  sudo dscl . -change /Users/root UserShell /bin/sh /bin/zsh

⇒  dscl . -read /Users/root UserShell
UserShell: /bin/zsh

⇒  sudo dscl . -change /Users/shiny UserShell /bin/sh /bin/zsh

⇒  dscl . -read /Users/shiny UserShell
UserShell: /bin/zsh

⇒  sudo su
Macbook-Sixx# echo $0
zsh
Macbook-Sixx# exit
[email protected]

 

 

 

 

During startup - Warning messages:
1: Setting LC_CTYPE failed, using "C" 
2: Setting LC_COLLATE failed, using "C" 
3: Setting LC_TIME failed, using "C" 
4: Setting LC_MESSAGES failed, using "C" 
5: Setting LC_MONETARY failed, using "C" 
Error in loadNamespace(name) : there is no package called 'digest'
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted
sh: rm: command not found
Error in loadNamespace(name) : there is no package called 'shiny'
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted
sh: rm: command not found

 

⇒  locale
LANG=
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=

https://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html#Internationalization-of-the-R_002eapp

  1. Open Terminal
  2. Write or paste in: defaults write org.R-project.R force.LANG en_US.UTF-8
  3. Close Terminal
  4. Start R

⇒ export LANG=en_US.UTF-8
⇒ export LC_ALL=en_US.UTF-8

R> Sys.setenv(LC_ALL="en_US.UTF-8")
R> Sys.setenv(LANG="en_US.UTF-8")

버전 확인

> system('shiny-server --version', intern = TRUE)
[1] "Shiny Server v1.5.3.838" "Node.js v6.10.0"

 

Categories: R Basic

onesixx

Blog Owner

Leave a Reply

Your email address will not be published.